Group,
After I select a cell how do I assign the contents of the cell into a variable? Seems trivial, but it has me stuck.
Learning VBA and loving it........
Tony
Group,
After I select a cell how do I assign the contents of the cell into a variable? Seems trivial, but it has me stuck.
Learning VBA and loving it........
Tony
dim var1 as ________
var1 = activecell
where var1 is the variable name
goto the help menu and type in dim. I will help determine what should go in the above underlined section.
For example, if the value in the cell is a serial number with leading zeros, dim as a string. If you were to dim as a double (number) then it might leave off the leading zeros.
Last edited by barrfly; 07-27-2005 at 11:31 AM.
Barrfly
myVar = Activecell
but no need to select it
myVar = Range("A1").Value
--
HTH
Bob Phillips
"ajocius" <[email protected]> wrote in
message news:[email protected]...
>
> Group,
> After I select a cell how do I assign the contents of the cell
> into a variable? Seems trivial, but it has me stuck.
>
> Learning VBA and loving it........
>
> Tony
>
>
> --
> ajocius
> ------------------------------------------------------------------------
> ajocius's Profile:
http://www.excelforum.com/member.php...o&userid=17695
> View this thread: http://www.excelforum.com/showthread...hreadid=390560
>
somethink like this should work, not sure what you have in the cell, though
Dim MyText As String
Sub Mytest()
MyText = Range("b2").Value
MsgBox MyText
End Sub
--
Gary
"ajocius" <[email protected]> wrote in
message news:[email protected]...
>
> Group,
> After I select a cell how do I assign the contents of the cell
> into a variable? Seems trivial, but it has me stuck.
>
> Learning VBA and loving it........
>
> Tony
>
>
> --
> ajocius
> ------------------------------------------------------------------------
> ajocius's Profile:
> http://www.excelforum.com/member.php...o&userid=17695
> View this thread: http://www.excelforum.com/showthread...hreadid=390560
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks