ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using a function in a macros to enter data in a specified cell (https://www.excelbanter.com/excel-programming/317861-using-function-macros-enter-data-specified-cell.html)

MaxRussell

Using a function in a macros to enter data in a specified cell
 
I have identified a cell address using the "address" function. I would like
to use the identified address to enter data into a cell using a macros. Would
someone please help?

Chip Pearson

Using a function in a macros to enter data in a specified cell
 
If you have the address of a cell in a variable, say sAddr, you
can use this variable with the Range property to access that
cell. For example,


Dim sAddr As String
sAddr = "A1"
Range(sAddr).Value = 123


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"MaxRussell" wrote in
message
...
I have identified a cell address using the "address" function. I
would like
to use the identified address to enter data into a cell using a
macros. Would
someone please help?




FuzzyDove[_5_]

Using a function in a macros to enter data in a specified cell
 

If I understand your question, then it is very straight forward. Th
example below takes the values in cells D1 through D5, adds them up an
puts the result in the cell where you grabbed the address (in this cas
cell A1).

MyAddress = Range("A1").Address

Application.Sheets("Sheet1").Range(MyAddress).Form ula = "=sum(D1:D5)

--
FuzzyDov
-----------------------------------------------------------------------
FuzzyDove's Profile: http://www.excelforum.com/member.php...fo&userid=1667
View this thread: http://www.excelforum.com/showthread.php?threadid=32063



All times are GMT +1. The time now is 10:25 AM.

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