PDA

View Full Version : Automatically move to next sheet and perform Macro



vradhak7
08-10-2016, 09:33 AM
Hello EXPERTS,
I have this VBA code.

I need this code to automatically perform it in the next sheets. (Sheet2 and Sheet3) and copy the results after the last used row of the target sheet (Sheet 4). How do I add that piece to this existing code ? Thanks in advance!
Sub test()
Dim LR As Long, i As Long
With Sheets("Sheet1")
LR = .Range("G" & Rows.Count).End(xlUp).Row
For i = 1 To LR
If .Range("G" & i).Value = 1 Then .Rows(i).Copy Destination:=Sheets("Sheet4").Range("A" & Rows.Count).End(xlUp).Offset(1)
Next i
End Sub

vradhak7
08-10-2016, 10:43 PM
Can anyone suggest their ideas on how to go about doing this?

xavier73
08-11-2016, 03:59 AM
Maybe this code will work.


Sub start()
For i = 2 To Sheets.Count
Sheets(i).Select
test
Next i
End Sub