Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Variable Contents Into Cell

4 views
Skip to first unread message

Himszy

unread,
Dec 29, 2004, 8:37:57 AM12/29/04
to
Hi

How do you insert the contents of a variable into a cell?

Thanks Michael


Himszy

unread,
Dec 29, 2004, 8:53:17 AM12/29/04
to

"Himszy" <n...@spam.com> wrote in message
news:VqyAd.19731$0W6....@fe2.news.blueyonder.co.uk...

> Hi
>
> How do you insert the contents of a variable into a cell?
>
> Thanks Michael
>
>
Also, how do you save the contents of a cell to a variable


Nick Hodge

unread,
Dec 29, 2004, 9:30:49 AM12/29/04
to
Michael

Comment lines are preceded with '

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
nick_hodge...@zen.co.uk.ANDTHIS


"Himszy" <n...@spam.com> wrote in message

news:hFyAd.19798$0W6....@fe2.news.blueyonder.co.uk...

Himszy

unread,
Dec 29, 2004, 11:50:23 AM12/29/04
to

"Nick Hodge" <nick_hodge...@zen.co.uk.ANDTHIS> wrote in message
news:OmDC$Lb7EH...@TK2MSFTNGP09.phx.gbl...

Thanks Nick


0 new messages