hi have this macro which works fine, but i want to run it on all sheets in the workbook, barring 4.
i'm new to macros, can someone hep detect the error in this.
i'm new to macros, can someone hep detect the error in this.
VBA Code:
Sub Macro1()
' Keyboard Shortcut: Ctrl+Shift+P
Dim Ws As Worksheet
For Each Ws In Worksheets
Select Case Ws.Name
Case "Sheet1", "live Sheet", "Total P&L", "Sheet1 (formula)"
Case Else
Selection.End(xlUp).Select
Range("V15").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[-11]=""open"",0,R[-1]C[-1]*(RC[-20]-R[-1]C[-20]))"
Range("V15").Select
Selection.AutoFill Destination:=Range("V15:V1361")
Range("V15:V1361").Select
Range("Y15").Select
Selection.End(xlUp).Select
Range("Y15").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[-14]=""open"",0,R[-1]C[-1]*(RC[-22]-R[-1]C[-22]))"
Range("Y15").Select
Selection.AutoFill Destination:=Range("Y15:Y1361")
Range("Y15:Y1361").Select
End Select
Next Ws
End Sub