quaziblue
asked on
Move Sheet If It Exists
Hi Experts-
I want to move a sheet if it exists. I came up with the code below and am curious why it won't work. Any help would be appreciated.
I want to move a sheet if it exists. I came up with the code below and am curious why it won't work. Any help would be appreciated.
Dim ws As Worksheet
Dim i As Long
For Each ws In ActiveWorkbook.Worksheets
If ws.Name = "France" Then
Sheets("France").Move Before:=Sheets("Germany")
End If
Next ws
ASKER
Thanks Saurabh. As always, your help is awesome. Could you give me the full code? In many ways, I'm still a newbie. Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect solution. Thanks!
Rather then doing the loop, You can do what you are looking for in simple two commands which is this...
This will even move to the next step even when the worksheet is not there...
Saurabh...
Open in new window