Forum Discussion

Oscar Ceballos's avatar
Oscar Ceballos
Copper Contributor
Oct 29, 2017

macor code

Hello everyone,

I need help creating a VBA code to run a Macro on all sheets in the active workbook of Ex cell?

All advice is highly thanked.

 

 

 

 

  • Hello,

     

    here is something to get you started. This code loops through all worksheets in the current workbook and pops up a message with the worksheet name.

     

     

    Sub LoopWorksheets()
    Dim ws As Worksheet
    
    For Each ws In ThisWorkbook.Worksheets
    ' do something
        MsgBox ws.Name
    Next ws
    End Sub

    does that help?

     

Resources