ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   copying cell to a range (https://www.excelbanter.com/excel-worksheet-functions/243766-copying-cell-range.html)

Tami

copying cell to a range
 
In my macro, i identify the active cell address, row# and column #
L=activecell.row
in this example assume the active cell address is D20
then i need to copy that cell to AC20:BB:20 and BF20:BZ20
(if i was on D30, I would be copying to AC30:BB:30 and BF30:BZ20, etc)
i'm having trouble writing the range part with the colon.

do i make a string using ampersands? Range=("AC"&L&":BB:"&L).select?
thanks in advance!
tami


Jacob Skaria

copying cell to a range
 
Dim lngRow As Long
lngRow = ActiveCell.Row
ActiveCell.Copy Range("AC" & lngRow & ":BB" & _
lngRow & ",BF" & lngRow & ":BZ" & lngRow)

PS: There are other ways to refer a range. Check out help on Range.Resize

If this post helps click Yes
---------------
Jacob Skaria


"Tami" wrote:

In my macro, i identify the active cell address, row# and column #
L=activecell.row
in this example assume the active cell address is D20
then i need to copy that cell to AC20:BB:20 and BF20:BZ20
(if i was on D30, I would be copying to AC30:BB:30 and BF30:BZ20, etc)
i'm having trouble writing the range part with the colon.

do i make a string using ampersands? Range=("AC"&L&":BB:"&L).select?
thanks in advance!
tami


Tami

copying cell to a range
 
Worked! thanks much!!
(p.s. if you get a chance, i have an unanswered question out there called
"Edit Replace String")
thx again
tami

"Jacob Skaria" wrote:

Dim lngRow As Long
lngRow = ActiveCell.Row
ActiveCell.Copy Range("AC" & lngRow & ":BB" & _
lngRow & ",BF" & lngRow & ":BZ" & lngRow)

PS: There are other ways to refer a range. Check out help on Range.Resize

If this post helps click Yes
---------------
Jacob Skaria


"Tami" wrote:

In my macro, i identify the active cell address, row# and column #
L=activecell.row
in this example assume the active cell address is D20
then i need to copy that cell to AC20:BB:20 and BF20:BZ20
(if i was on D30, I would be copying to AC30:BB:30 and BF30:BZ20, etc)
i'm having trouble writing the range part with the colon.

do i make a string using ampersands? Range=("AC"&L&":BB:"&L).select?
thanks in advance!
tami



All times are GMT +1. The time now is 09:16 AM.

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