Hello, I am using the following macro to paste values on all worksheets that begin with "Labor BOE".
Unfortunately, it is not looping through my worksheets and doing this action to all "Labor BOE" worksheets. It only works on the active worksheet. Any thoughts on where I am going wrong?
- Loop through worksheets and find those that start with "Labor BOE..."
- Select all cells
- Paste values (Alt+E+S+V)
Unfortunately, it is not looping through my worksheets and doing this action to all "Labor BOE" worksheets. It only works on the active worksheet. Any thoughts on where I am going wrong?
Code:
Sub AltESV()
' Scroll through worksheets
' For each worksheet that starts with Labor BOE...
' Select entire sheet (all cells)
' Paste Values (Alt+E+S+V)
For Each Sh In ActiveWorkbook.Sheets
If Left(Sh.Name, 9) = "Labor BOE" Then
With Cells.Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End with
End If
Next Sh
End Sub