![]() |
Checking Active Sheet is in an approved list
Hi Guys
I want my code to make a descion depending on whether or not the active sheet is in an approved list. I thought I would use an array for this as below If ActiveSheet.Name = Array("Addis ETB", "Addis USD", "Geneva USD", _ "HSBC Cards", "London GBP", "London USD", "Hong Kong HKD", "Hong Kong USD") Then But obviously my syntax is wrong. If someone could help with the syntax or let me know of a better way that would be fantastic. Thanks for reading this far, and in advance for any help Matt |
Checking Active Sheet is in an approved list
Dim tmpS as string
tmpS=ActiveSheet.Name If tmpS= "Addis ETB" OR tmpS = "Addis USD" OR tmpS = "Geneva USD"_ OR tmpS = "HSBC Cards" OR tmpS = "London GBP" OR tmpS = "London USD" OR tmpS = "Hong Kong HKD" OR tmpS = "Hong Kong USD" Then "Matt" wrote: Hi Guys I want my code to make a descion depending on whether or not the active sheet is in an approved list. I thought I would use an array for this as below If ActiveSheet.Name = Array("Addis ETB", "Addis USD", "Geneva USD", _ "HSBC Cards", "London GBP", "London USD", "Hong Kong HKD", "Hong Kong USD") Then But obviously my syntax is wrong. If someone could help with the syntax or let me know of a better way that would be fantastic. Thanks for reading this far, and in advance for any help Matt |
Checking Active Sheet is in an approved list
maybe?
myarray = Array("Sheet1", "Sheet2") For Each S In myarray If S = ActiveSheet.Name Then MsgBox "Hi" Next -- Don Guillett SalesAid Software "Matt" wrote in message ... Hi Guys I want my code to make a descion depending on whether or not the active sheet is in an approved list. I thought I would use an array for this as below If ActiveSheet.Name = Array("Addis ETB", "Addis USD", "Geneva USD", _ "HSBC Cards", "London GBP", "London USD", "Hong Kong HKD", "Hong Kong USD") Then But obviously my syntax is wrong. If someone could help with the syntax or let me know of a better way that would be fantastic. Thanks for reading this far, and in advance for any help Matt |
Checking Active Sheet is in an approved list
Thanks Muhammed
That did the trick Matt "Muhammed Rafeek M" wrote: Dim tmpS as string tmpS=ActiveSheet.Name If tmpS= "Addis ETB" OR tmpS = "Addis USD" OR tmpS = "Geneva USD"_ OR tmpS = "HSBC Cards" OR tmpS = "London GBP" OR tmpS = "London USD" OR tmpS = "Hong Kong HKD" OR tmpS = "Hong Kong USD" Then "Matt" wrote: Hi Guys I want my code to make a descion depending on whether or not the active sheet is in an approved list. I thought I would use an array for this as below If ActiveSheet.Name = Array("Addis ETB", "Addis USD", "Geneva USD", _ "HSBC Cards", "London GBP", "London USD", "Hong Kong HKD", "Hong Kong USD") Then But obviously my syntax is wrong. If someone could help with the syntax or let me know of a better way that would be fantastic. Thanks for reading this far, and in advance for any help Matt |
Checking Active Sheet is in an approved list
Another way:
dim myNames as variant dim res as variant mynames = Array("Addis ETB", "Addis USD", "Geneva USD", _ "HSBC Cards", "London GBP", "London USD", "Hong Kong HKD", "Hong Kong USD") res = application.match(activesheet.name,mynames,0) if iserror(res) then 'not found else 'found end if Matt wrote: Hi Guys I want my code to make a descion depending on whether or not the active sheet is in an approved list. I thought I would use an array for this as below If ActiveSheet.Name = Array("Addis ETB", "Addis USD", "Geneva USD", _ "HSBC Cards", "London GBP", "London USD", "Hong Kong HKD", "Hong Kong USD") Then But obviously my syntax is wrong. If someone could help with the syntax or let me know of a better way that would be fantastic. Thanks for reading this far, and in advance for any help Matt -- Dave Peterson |
All times are GMT +1. The time now is 10:09 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com