Ignoring Sheet in For Each Loop

  • Thread starter Thread starter ExcelMonkey
  • Start date Start date
E

ExcelMonkey

I have a loop which looks through each sheet in my
workbook and then looks through cells. I wanted to set it
up so that it ignores ones specific sheet called"Audit
Results".

For Each sh In .Worksheets
If LCase(sh.Name) <> "Audit Results" Then
Code
Next

However it is not working. Can anyone tell me why?

Thanks
 
I mentioned to you before that this would not work. You are shifting the
case of the sh.Name down, but testing against proper case. Try

If LCase(sh.Name) <> "audit results" Then

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
ExcelMonkey

You are setting the sh.name to lower case and then comparing it to text
which is proper case, so the Audit Sheet will be audit sheet when tested
against Audit Sheet. If you want to leave LCase then change the test to
"audit sheet".

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
 
Thankx. I remember you addressing it a previous post but
I missed your point. I get it now.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top