2016-11-30 5 views
0

データ分析を可能にするために処理する必要がある膨大なデータがあります。 現在、データはthis formで、私の目標はVBAを使用してthisを生産することです。VBAに関連するデータを含む日付範囲を拡張する

アイデア?

+0

こんにちは、マイケル・S、あなたはVBAでこれまでに試した何か正確にあなたが持つ問題を抱えているものを私たちを見ることができますか? – Clusks

+0

フィルタを使用するだけではどうですか。最初の行を強調表示し、次にExcelのデータタブでフィルタ –

答えて

0

これを試してください。あなたの例のために働く必要があります...

Sub Dates() 

Dim LastRow As Long 
Dim RowIns As Integer 

LastRow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row 

For i = 2 To LastRow 

Cont: 

    If Cells(i, 1).Value = "" Then 

     GoTo Cont2 

    End If 

    RowIns = Cells(i, 4).Value - Cells(i, 3).Value 

    If RowIns <= 0 Then 

     i = i + 1 

     GoTo Cont 

    End If 

    Rows(i + 1 & ":" & RowIns + i).Insert Shift:=xlDown 

    Range("C" & i).Select 
    Selection.AutoFill Destination:=Range("C" & i & ":C" & RowIns + i), Type:=xlFillDefault 

    Range("A" & i & ":B" & i).Select 
    Selection.AutoFill Destination:=Range("A" & i & ":B" & RowIns + i), Type:=xlFillCopy 

    LastRow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row 

    i = i + RowIns + 1 

    GoTo Cont 

Next 

Cont2: 

Columns(4).EntireColumn.Delete 

End Sub 
+0

を選択してくださいありがとうございます!朝、これを最初に試してみます。ご多幸を祈る。 –

関連する問題