oleg_v
03-09-2010, 04:25 AM
HI
I HAVE THIS MACRO:
Public Sub ProcessData()
Const TEST_COLUMN As String = "Ae" '<=== change to suit
Dim i As Long
Dim LastRow As Long
Dim NextRow As Long
NextRow = 6
Dim mnth As Long
With ActiveSheet
mnth = InputBox("Supply the required month number")
If mnth > 0 And mnth <= 12 Then
LastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = 1 To LastRow
If Month(.Cells(i, "AE").Value) = mnth Then
NextRow = NextRow + 1
.Cells(i, "E").Resize(, 26).Copy Worksheets("Sheet2").Cells(NextRow, "d")
End If
Next i
End If
End With
End Sub
I need to change this macro that it not copy rows by month i need it to copy the rows that in column "ae" in cell 4_th and 5_th numbers from the left is "02"
i think that the change should be in the rows:
mnth = InputBox("Supply the required month number") If mnth > 0 And mnth <= 12 Then
thanks
I HAVE THIS MACRO:
Public Sub ProcessData()
Const TEST_COLUMN As String = "Ae" '<=== change to suit
Dim i As Long
Dim LastRow As Long
Dim NextRow As Long
NextRow = 6
Dim mnth As Long
With ActiveSheet
mnth = InputBox("Supply the required month number")
If mnth > 0 And mnth <= 12 Then
LastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = 1 To LastRow
If Month(.Cells(i, "AE").Value) = mnth Then
NextRow = NextRow + 1
.Cells(i, "E").Resize(, 26).Copy Worksheets("Sheet2").Cells(NextRow, "d")
End If
Next i
End If
End With
End Sub
I need to change this macro that it not copy rows by month i need it to copy the rows that in column "ae" in cell 4_th and 5_th numbers from the left is "02"
i think that the change should be in the rows:
mnth = InputBox("Supply the required month number") If mnth > 0 And mnth <= 12 Then
thanks