I am very new with programming and I am trying to finish a small Project for my Company. I am trying to write a code that loops through a range and for every cell.value greater than 0 it will find corresponding excel sheet and execute the specific code. Thank you!
Sub test()
Dim rng As Range, cell As Range
Set rng = Range("B3:B53")
For Each cell In rng
If cell > 0 Then
SheetName = ThisWorkbook.Sheets(cell.Value)
ThisWorkbook.Sheets(SheetName).Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1
Range("E4:P50").Select
Selection.ClearContest
End If
Next cell
End Sub
Try:
Hopefully this is what you are looking for.. A simple code
You can add more cell values by setting its variables.
Please let us know if you have any query..
Try