Copy and Paste down the column

E

ExcelNovice

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.
 
K

Ken Hudson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top