ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy down macro (https://www.excelbanter.com/excel-programming/277371-copy-down-macro.html)

JamesA

Copy down macro
 
I want to copy data down a column in a ws until it finds
an existing entry in the same column. It should the copy
that entry down same column until it finds the next
entry ...
Would someone please help me with a macros or vb fo this
task. I would be very grateful.

JA

Tom Ogilvy

Copy down macro
 

With Activesheet
set rng1 = Intersect(.Columns(1)EntireColumn,.UsedRange)
End with
set rng2 = rng1.specialcells(xlBlanks)
rng2.Formula = "=" & rng2(0).offset(-1,0).Address(0,0)
set rng3 = Activesheet.Range(rng2(1),rng1(rng1.count))
rng3.Formula = rng3.Value

Assumes there are no formulas in the column.

--
Regards,
Tom Ogilvy

JamesA wrote in message
...
I want to copy data down a column in a ws until it finds
an existing entry in the same column. It should the copy
that entry down same column until it finds the next
entry ...
Would someone please help me with a macros or vb fo this
task. I would be very grateful.

JA





All times are GMT +1. The time now is 06:51 AM.

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