Consulting

Results 1 to 3 of 3

Thread: Automatically move to next sheet and perform Macro

  1. #1
    VBAX Regular
    Joined
    Aug 2014
    Posts
    26
    Location

    Automatically move to next sheet and perform Macro

    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

  2. #2
    VBAX Regular
    Joined
    Aug 2014
    Posts
    26
    Location
    Can anyone suggest their ideas on how to go about doing this?

  3. #3
    VBAX Regular
    Joined
    Aug 2016
    Posts
    20
    Location
    Maybe this code will work.

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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •