Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
CodeName Referencing Help
I want to exclude 4 worksheets from my macro. Is there are better way to
write the below? If Project.CodeName < "Sheet01" And Project.CodeName < "Sheet02" And Project.CodeName < "Sheet03" And Project.CodeName < "Sheet04" |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
CodeName Referencing Help
I find that a Select Case statement is easier to understand and maintain.
Select Case project.CodeName Case "Sheet01", "Sheet02", "Sheet03", "Sheet04" ''''''''''''''' ' do nothing ''''''''''''''' Case Else ''''''''''''''' ' do something ''''''''''''''' End Select -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com (email address is on the web site) "AucklandAssault" wrote in message ... I want to exclude 4 worksheets from my macro. Is there are better way to write the below? If Project.CodeName < "Sheet01" And Project.CodeName < "Sheet02" And Project.CodeName < "Sheet03" And Project.CodeName < "Sheet04" |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
CodeName Referencing Help
Thanks a lot. Just learning so the help is appreciated.
"Chip Pearson" wrote: I find that a Select Case statement is easier to understand and maintain. Select Case project.CodeName Case "Sheet01", "Sheet02", "Sheet03", "Sheet04" ''''''''''''''' ' do nothing ''''''''''''''' Case Else ''''''''''''''' ' do something ''''''''''''''' End Select -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com (email address is on the web site) "AucklandAssault" wrote in message ... I want to exclude 4 worksheets from my macro. Is there are better way to write the below? If Project.CodeName < "Sheet01" And Project.CodeName < "Sheet02" And Project.CodeName < "Sheet03" And Project.CodeName < "Sheet04" |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
CodeName Referencing Help
Hi. Select Case is the way to go.
Just to mention an alternative if your pattern is rather simple as in your example... Sub Demo() Dim cn 'cn = Project.CodeName cn = "Sheet02" '<- Test If cn Like "Sheet0[1234]" Then Debug.Print "Exclude this" End If End Sub -- HTH :) Dana DeLouis Windows XP & Office 2003 "AucklandAssault" wrote in message ... Thanks a lot. Just learning so the help is appreciated. "Chip Pearson" wrote: I find that a Select Case statement is easier to understand and maintain. Select Case project.CodeName Case "Sheet01", "Sheet02", "Sheet03", "Sheet04" ''''''''''''''' ' do nothing ''''''''''''''' Case Else ''''''''''''''' ' do something ''''''''''''''' End Select -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com (email address is on the web site) "AucklandAssault" wrote in message ... I want to exclude 4 worksheets from my macro. Is there are better way to write the below? If Project.CodeName < "Sheet01" And Project.CodeName < "Sheet02" And Project.CodeName < "Sheet03" And Project.CodeName < "Sheet04" |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
string to codename | Excel Discussion (Misc queries) | |||
codename help | Excel Programming | |||
Referencing worksheet CODENAME in a chart object. | Excel Discussion (Misc queries) | |||
Referencing worksheet CODENAME in a chart object. | Excel Programming | |||
Worksheet codename | Excel Programming |