Hello Everyone.
I require some help on my macro. What i want to do is the following. I have 3 sheets.
Sheet 1 ("Macro Value Set"):
Sheet 2 ("Data")
Sheet 3 ("Output")
This sheet checks the second sheet to see if there is data accoring to the specific account. Should there be data the sheet will indicate "1". Therefore if the data is there the macro should then filter Sheet2 ("Data") accoring to the active cell in Sheet 1 offset by one column to the lefts value. After it has then filtered the sheet it should copy the data from sheet 2 to sheet 3 ("Output"). After it has copied it should then go back to sheet 1 and offset to the next row and perfomr the check again and if value is 1 then it should perform the process again. Should the value be 0 and not 1 in sheet 1 it should just move to the next cell. The macro should loop until the first empty cell is reached in sheet1.
At current my code looks like this but I get a lot of errors would you guys please be so kind to assists me with this.
Thanks in advance for your assistance.
Sub Test2()
Sheets("Output").Range("A6:Q3000").ClearContents
Sheets("Macro Value Set").Select
' Select cell A2, *first line of data*.
Range("C4").Select
' Set Do loop to stop when an empty cell is reached.
Do Until IsEmpty(ActiveCell)
' Insert your code here.
If ActiveCell.Value = "1" Then
Do
Application.ScreenUpdating = False
With Sheets("Data")
'.ShowAllData
Sheets("Data").Select
ActiveSheet.Range("$A$1:$V$1000000").AutoFilter Field:=17, Criteria1:=Sheets("Macro Value Set").ActiveCell
Intersect(.UsedRange, .UsedRange.Offset(0)).SpecialCells(xlCellTypeVisible).Copy
End With
Sheets("Output").Select
Sheets("Output").Cells(Rows.Count, 1).End(xlUp).Offset(1).PasteSpecial xlPasteValues
Sheets("Output").AutoFilterMode = False
Application.ScreenUpdating = True
' Step down 1 row from present location.
Sheets("Macro Value Set").Select
ActiveCell.Offset(1, 0).Select
End If
Loop
'End If ActiveCell.Value = "End"
End Sub
Bookmarks