Excel Macro Help

chrono2483

Board Regular
Joined
Aug 23, 2014
Messages
164
Office Version
  1. 2016
Hello,

I pulled some raw data of 15000 rows, and trying to fill in some of the blanks to be able to convert into a pivot table. The challenge is:

1) Each date has several rows corresponding to it:

December 5
Cat
15
345
Dog
36
564
Rat
56
654
December 6
Frog
22
794
Ant
2
242

<tbody>
</tbody>

What I need to do is copy each date into the blank spaced below. Currently, what I have to do to avoid expanding in sequential order is copy/paste the date into the cell below then highlight both cells and double click the bottom/right square box to expand to the last empty cell in the column.

However, with 4 months worth of dates, it can get quite tedious. Is there an easier way to do this?


Thank you!
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Try this:
Assuming your dates are in column "A"

Code:
Sub FillBlanks()
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
    For i = 2 To Lastrow
        If Cells(i, 1).Value = "" Then Cells(i, 1).Value = Cells(i, 1).Offset(-1).Value
    Next
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,151
Messages
6,129,162
Members
449,489
Latest member
spvclub

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