Sub DemoVariable()
'Dimensions two variables
Dim sName1 As String, sName2 As String
'Assigns one a string value
sName1 = "Nick Hodge"
'Passes that string value to the
'range A1 on active sheet
Range("A1").Value = sName1
'Picks up a value from A2 on active sheet
'and assigns to 2nd variable
sName2 = Range("A2").Value
'Displays message box with 2nd variable value
MsgBox sName2
End Sub
--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
Sub DemoVariable()
'Dimensions two variables
Dim sName1 As String, sName2 As String
'Assigns one a string value
sName1 = "Nick Hodge"
'Passes that string value to the
'range A1 on active sheet
Range("A1").Value = sName1
'Picks up a value from A2 on active sheet
'and assigns to 2nd variable
sName2 = Range("A2").Value
'Displays message box with 2nd variable value
MsgBox sName2
End Sub
--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.