ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA - Cell Assignment (https://www.excelbanter.com/excel-programming/335648-vba-cell-assignment.html)

ajocius[_7_]

VBA - Cell Assignment
 

Group,
After I select a cell how do I assign the contents of the cel
into a variable? Seems trivial, but it has me stuck.

Learning VBA and loving it........

Ton

--
ajociu
-----------------------------------------------------------------------
ajocius's Profile: http://www.excelforum.com/member.php...fo&userid=1769
View this thread: http://www.excelforum.com/showthread.php?threadid=39056


Bob Phillips[_7_]

VBA - Cell Assignment
 
myVar = Activecell

but no need to select it

myVar = Range("A1").Value

--
HTH

Bob Phillips

"ajocius" wrote in
message ...

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




Gary Keramidas[_2_]

VBA - Cell Assignment
 
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" wrote in
message ...

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




barrfly[_8_]

VBA - Cell Assignment
 

var1 = activecell

where var1 is the variable nam

--
barrfl

Excel User - Energy market
-----------------------------------------------------------------------
barrfly's Profile: http://www.excelforum.com/member.php...nfo&userid=414
View this thread: http://www.excelforum.com/showthread.php?threadid=39056



All times are GMT +1. The time now is 12:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com