ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Locating a cell within a macro (https://www.excelbanter.com/excel-worksheet-functions/122955-locating-cell-within-macro.html)

Ron (Bismark)

Locating a cell within a macro
 
I have a lookup which gives me a cell ref in terms of R1C1 into cell A2
On the same sheet I have a value that I want to copy from Cell B2 into the
cell referenced to in A2.

I have a very basic knowledge of macros and not sure if this is possible.

Can anyone help?

thanks,

Ron.


Martin Fishlock

Locating a cell within a macro
 
Ron,

The macro is as below. The tricky bit is to conver the R1C1 style reference
to A1 style:

Sub IndirectCopy()
Const cCellValue As String = "B2"
Const cCellIndirect As String = "A1"
Dim sCell As String
sCell = Application.ConvertFormula(Range(cCellIndirect), _
xlR1C1, xlA1)
Range(sCell).Value = Range(cCellValue).Value
End Sub


--
Hope this helps
Martin Fishlock
Please do not forget to rate this reply.


"Ron (Bismark)" wrote:

I have a lookup which gives me a cell ref in terms of R1C1 into cell A2
On the same sheet I have a value that I want to copy from Cell B2 into the
cell referenced to in A2.

I have a very basic knowledge of macros and not sure if this is possible.

Can anyone help?

thanks,

Ron.



All times are GMT +1. The time now is 02:42 PM.

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