Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello All,
Is there a way to use a variable in an If statement? I have collected some information in one part of my subroutine and would like it to be the conditional of the If statement like this: Workbooks(orgFile).Worksheets("Cost Centers").Activate Range("C2").Select strGetCostCenter = """" & "790-30-00" & """" & " OR Temp = " & """" & ActiveCell.Value & """""" ActiveCell.Offset(1, 0).Range("A1").Select Do Until ActiveCell = "" strGetCostCenter = strGetCostCenter & " OR Temp = " & """" & ActiveCell.Value & """" ActiveCell.Offset(1, 0).Range("A1").Select Loop If Temp = strGetCostCenter Then endif If have looked at the results of the strGetCostCenter variable and it matches exactely what I would use manually in the If statement. Any suggestions would be greatly appreciated. Regards, Rob |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Variable statement | Excel Discussion (Misc queries) | |||
Variable in if statement | Excel Worksheet Functions | |||
using a variable for MOD Statement | Excel Programming | |||
if than statement has too many variable | New Users to Excel | |||
Macro Creating Variable and using variable in a SQL statement | Excel Programming |