Dim Xsh As Worksheet at Worksheet Dot Com

Dim Xsh As Worksheet. Set hpgbr = dim wsparent as worksheet set wsparent = hpgbr.parent You must declare wss as a sheets object.

How to run the same macro on multiple worksheets at same
How to run the same macro on multiple worksheets at same from www.extendoffice.com

Set hpgbr = dim wsparent as worksheet set wsparent = hpgbr.parent Dim xsh as worksheet for each xsh in worksheets ' for every sheet in wb if xsh.visible then ' if visible dim sheetdate as date sheetdate = xsh.cells(4.2).value ' set sheetdate as the date on sheet if sheetdate = date then ' if date on sheet = the actual date xsh.select ' select that sheet and exit for exit for else ' else loop till you find it end if ' else just stay on the. Insert a module in vba editor and copy above vba code.

How to run the same macro on multiple worksheets at same

Set hpgbr = dim wsparent as worksheet set wsparent = hpgbr.parent Dim xsh as worksheet application.screenupdating = false for each xsh in worksheets xsh.select call runcode next application.screenupdating = true end sub sub runcode() with worksheets(2018).enableoutlining = true.enableselection = xlnorestrictions.protect password:=workana1234, _ contents:=true, userinterfaceonly:=true end with end sub Set ws = dim wsnext as worksheet set wsnext = ws.next dim ws as worksheet: Ive pasted my current code below.