Trying to code up a Macro but my string is very long - How do I do a continue on the next line?

RudeBoy

Active Member
Joined
Feb 2, 2003
Messages
424
Office Version
  1. 365
Platform
  1. Windows
Trying to code up a Macro but my string is very long - How do I do a continue on the next line? I googled it but the solution is not working :(
I am trying to string many worksheets & the -, at the end of the line and the & at the next line is not working :( thanks for your help

MACRO CODE below:

Sub WaxOFF()
'
' WaxOFF Macro
' Macro to Turn rename all = signs to /=
'

'
Application.Goto Reference:="WaxOFF"

Dim ws As Worksheet

For Each ws In Worksheets(Array("M-Mix-Dbls-1", "M-Mix-Dbls-2", "M-Mix-Dbls-3-Manual-WRK-NEEDED" _ ,
& "M-Mix-Dbls-SORT","M-Mix-Dbls-Final-Pass","M-Mix-Dbls-FINAL-PREP","M-Mix-Dbls-FINAL-DONE" _ ,
& "Mixed-DBLS-M-Labels","M-Mix-Dbls-FINAL","W-Mix-Dbls-1","W-Mix-Dbls-2","W-Mix-Dbls-3-Manual-WRK-NEEDED" _ ,
& "W-Mix-Dbls-SORT","W-Mix-Dbls-Final-Pass","W-Mix-Dbls-FINAL-PREP","W-Mix-Dbls-FINAL-DONE","Mixed-DBLS-W-Labels" _ ,
& "Team-Event-Labels","M-Singles-Labelz","W-Singles-Labelz","Mens-DBLs-Labelz","W-DBLs-Labelz","MSSP-Labelz-GM1" _ ,
& "MSSP-Labelz-GM2","MSSP-Labelz-GM3","WSSP-Labelz-GM1","WSSP-Labelz-GM2","WSSP-Labelz-GM3" ))

ws.Cells.Replace What:="=", Replacement:="/=", LookAt:=xlPart
Next ws

End Sub
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Not exactly how I'd do it, but you can get it to work like this:

VBA Code:
    For Each ws In Worksheets(Array("sheet1", _
                              "sheet2", "sheet3", _
                              "Sheet4"))
 
Upvote 0
Not exactly how I'd do it, but you can get it to work like this:

VBA Code:
    For Each ws In Worksheets(Array("sheet1", _
                              "sheet2", "sheet3", _
                              "Sheet4"))
Hmm I am getting a compile error not sure why?
Thanks for the help
compile error.jpg
 
Upvote 0
You need to put a space before the underscore (continuation mark) at the end of each line
 
Upvote 0
And you don't have either the space or the underscore on the first line !
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top