ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Specifying 2 sheet names (https://www.excelbanter.com/excel-programming/283941-specifying-2-sheet-names.html)

Todd Huttenstine[_2_]

Specifying 2 sheet names
 
Hey guys

Below is a working code that says if sheet name in
workbook is "template", then bflag=true. I would like it
to say if sheet name in workbook is "template"
or "variables", then bflag=true

If LCase(sh.Name) = "template" Then bFlag = True

How would I write this?

Thanx

Todd

Chip Pearson[_2_]

Specifying 2 sheet names
 
Todd,

Try a Select Case. E.g.,

Select Case LCase(sh.Name)
Case "template", "variables"
bflag = True
Case Else
bflag = False
End Select



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Todd Huttenstine" wrote in
message ...
Hey guys

Below is a working code that says if sheet name in
workbook is "template", then bflag=true. I would like it
to say if sheet name in workbook is "template"
or "variables", then bflag=true

If LCase(sh.Name) = "template" Then bFlag = True

How would I write this?

Thanx

Todd




Bob Phillips[_6_]

Specifying 2 sheet names
 
Todd,

Just a simple Or

If LCase(sh.Name) = "template" Or LCase(sh.Name) = "variables" Then
bFlag = True

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Todd Huttenstine" wrote in message
...
Hey guys

Below is a working code that says if sheet name in
workbook is "template", then bflag=true. I would like it
to say if sheet name in workbook is "template"
or "variables", then bflag=true

If LCase(sh.Name) = "template" Then bFlag = True

How would I write this?

Thanx

Todd





All times are GMT +1. The time now is 05:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com