What would happen if?

DChambers

Active Member
Joined
May 19, 2006
Messages
257
What would be displayed in the MsgBox if I did this:

Dim Msg1 As String
Dim FN1 As Variant
Msg1 = "opening file 'FN1' "
'
'Later in code
'
Get FN1
'
'Later in code
'
MsgBox Msg1
'
I know code is not right but meaning should be clear.

Anyone?
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Your messagebox would say: opening file 'FN1'

You probably want to set Msg1 to this
Code:
Msg1 = "opening file "

Then once you have FN1 run this
Code:
Msgbox Msg1 & FN1
 
Last edited:
Upvote 0
Hi Mikey and KWMSeattle,

Mikey you are right the way I showed it and KWM that is the normal way to do it - I just did not make myself clear, I think I know what would happen now - since FN1 was not set it would probably be a null string.

Sorry for the confusion and thanks for your help!
 
Upvote 0

Forum statistics

Threads
1,214,854
Messages
6,121,941
Members
449,056
Latest member
denissimo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top