Ignore/skip worksheet

angelmaine4ever

New Member
Joined
Nov 1, 2017
Messages
10
Hi I have this code below that combines multiple worksheets data into one worksheet (Master).

I need to skip one of the sheets (READ ME is the tab name).

PLS. NEED YOUR HELP. THANKS!!!
Code:
Option Explicit
 
Sub Button2_Click()
Dim Sht As Worksheet
For Each Sht In ActiveWorkbook.Worksheets
If Sht.Name <> "Master" Then
Sht.Select
Range("A:A").Insert
Range("A2").Formula = "=Mid(Cell(""filename"",B1),Find(""]"",Cell(""filename""))+1,255)"
Range("A2").Copy
Range("A2").PasteSpecial Paste:=xlPasteValues
Range("A2:K2").Copy
Sheets("Master").Select
Range("A65536").End(xlUp).Offset(1, 0).Select
ActiveSheet.Paste
Sht.Select
Range("A:A").Delete
Else
End If
Next Sht
End Sub
 
Last edited by a moderator:

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Not sure but I think this will work:

"If Sht.Name <> "Master" OR Sht.Name <> "Read Me" Then"

Your fourth line of code.
 
Upvote 0
I was going to suggest AND rather than OR in that formula but I doubted that.

Not having something concrete to work with (and being much of an amateur) I'll give this as a chance.
It is saying to let everything other than "Read Me" pass. I'm a bit concerned about the Else and End If that I've added at the end.
In fact I don't think that either of us need the ELSE before terminating the IF statements.
Code:
Sub Button2_Click()
Dim Sht As Worksheet
For Each Sht In ActiveWorkbook.Worksheets
If Sht.Name <> "Master" Then
[COLOR=#ff0000]If Sht.Name <>”Read Me” then[/COLOR]

Sht.Select
………..
 
Range("A:A").Delete
Else
End If
[COLOR=#ff0000]Else
End if[/COLOR]
Next Sht
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,195
Members
453,021
Latest member
pingpong7117

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