Carly
Active Member
- Joined
- Aug 21, 2002
- Messages
- 370
I have used the following if statement in VBA
If Range("B2") = "Nov" Then _
MsgBox "Nov", vbInformation Else _
MsgBox "Error", vbInformation
This works fine but only if I open the workbook that I am referring to. Is it possible to work this statement without opening. I tried:
If Workbooks("\\sysdevweb\bw\PricingMethods\Data\Dates.xls").Sheets("Dates").Range("B2") = "Nov" Then _
MsgBox "Nov", vbInformation Else _
MsgBox "Error", vbInformation
but this brings back error - 'Subscript out of range'
Any help appreciated!
Thanks
If Range("B2") = "Nov" Then _
MsgBox "Nov", vbInformation Else _
MsgBox "Error", vbInformation
This works fine but only if I open the workbook that I am referring to. Is it possible to work this statement without opening. I tried:
If Workbooks("\\sysdevweb\bw\PricingMethods\Data\Dates.xls").Sheets("Dates").Range("B2") = "Nov" Then _
MsgBox "Nov", vbInformation Else _
MsgBox "Error", vbInformation
but this brings back error - 'Subscript out of range'
Any help appreciated!
Thanks