ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy and Paste down the column (https://www.excelbanter.com/excel-programming/403447-copy-paste-down-column.html)

ExcelNovice

Copy and Paste down the column
 
I need a macro to copy the first cell in a row down the column until it runs
into a existing value and then copy that value down until it meets another
existing value and then copy that value down the column and so on.

Dave Peterson

Copy and Paste down the column
 
Debra Dalgleish shares a manual technique and a code solution:
http://contextures.com/xlDataEntry02.html

ExcelNovice wrote:

I need a macro to copy the first cell in a row down the column until it runs
into a existing value and then copy that value down until it meets another
existing value and then copy that value down the column and so on.


--

Dave Peterson

Ken Hudson

Copy and Paste down the column
 
Hi,

Please make a back up copy of your workbook before testing. This macro
assumes that the data you want to copy is in column A.

Option Explicit

Dim RowCount As Double
Dim Iloop As Double
Sub CopyDown()

'Turn off warnings, etc.
Application.ScreenUpdating = False
Application.DisplayAlerts = False

RowCount = Cells(Rows.Count, "A").End(xlUp).Row
For Iloop = 1 To RowCount
If IsEmpty(Cells(Iloop, "A")) Then
Cells(Iloop, "A") = Cells(Iloop - 1, "A")
End If
Next Iloop

''Turn on warnings, etc.
Application.DisplayAlerts = True
Application.ScreenUpdating = True

End Sub
--
Ken Hudson


"ExcelNovice" wrote:

I need a macro to copy the first cell in a row down the column until it runs
into a existing value and then copy that value down until it meets another
existing value and then copy that value down the column and so on.



All times are GMT +1. The time now is 08:47 PM.

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