Copying down headings via VBA

omairhe

Well-known Member
Joined
Mar 26, 2009
Messages
2,040
Office Version
  1. 2019
Platform
  1. Windows
Hello all,

How are you? Hope you're doing well.

Need some help on a Vba that could copy down headings in columns BD to BL until last data cell in Column A.

So to simplify things up I made simple headings which in reality are not that simple but are a bit unique....

From this

Hce7pHW.png



To this

Hce7YFW.png




As you can see, the range BD to BL are copied down.

Please note that all headings are values and not formula.

Will appreciate ,

Thank you.
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Try this:
Code:
Sub Test()
'Modified 3-16-18 7:20 PM EDT
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
    For i = 1 To Lastrow
        If Cells(i, "BD").Value = "" Then
            Cells(i, "BD").Resize(, 64).Value = Cells(i - 1, "BD").Resize(, 64).Value
        End If
Next
Application.ScreenUpdating = True
End Sub
'BD BL
 
Upvote 0
I made a mistake.
Try this:
Code:
Sub Test()
'Modified 3-16-18 7:40 PM EDT
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
    For i = 1 To Lastrow
        If Cells(i, "BD").Value = "" Then
            Cells(i, "BD").Resize(, 9).Value = Cells(i - 1, "BD").Resize(, 9).Value
        End If
Next
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Thanks a million..

I made a mistake.
Try this:
Code:
Sub Test()
'Modified 3-16-18 7:40 PM EDT
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
    For i = 1 To Lastrow
        If Cells(i, "BD").Value = "" Then
            Cells(i, "BD").Resize(, 9).Value = Cells(i - 1, "BD").Resize(, 9).Value
        End If
Next
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top