Fill in between empty spaces macro

jccrespo208

New Member
Joined
May 20, 2010
Messages
8
Hi,

I'm trying to create a macro where I can automatically fill down the data between empty spaces.

Here's what I have to give you an idea:

GROUPEE#ID#TID#
ABC12341001XXX-XX-1234
ABC
ABC
ABC
ABC
ABC23451002XXX-XX-0002
ABC
ABC
ABC34561003XXX-XX-1003
ABC
ABC

<tbody>
</tbody>



So basically what I'm trying to do is to use the macro to fill down the data with the information that I have for each employee.

thanks!
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
lastrow = Cells.Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row 'determines the dynamic last row for looping
for x = 2 to lastrow 'assume header is on row 1
'column B
if trim(cells(x,1))<>"" and trim(cells(x,2))="" then
cells(x,2) = cells(x-1,2)
endif
'column C
if trim(cells(x,1))<>"" and trim(cells(x,3))="" then
cells(x,3) = cells(x-1,3)
endif
'column D
if trim(cells(x,1))<>"" and trim(cells(x,4))="" then
cells(x,4) = cells(x-1,4)
endif

next x
msgbox "Done!"
 
Upvote 0
Here is another macro (a non-looping one) for you to try...

Code:
Sub FillInBlanks()
  On Error GoTo NoBlanks
  With Range("B3:D" & Cells(Rows.Count, "A").End(xlUp).Row)
    .SpecialCells(xlBlanks).FormulaR1C1 = "=R[-1]C"
    .Value = .Value
  End With
NoBlanks:
End Sub
 
Upvote 0
Thanks!!

Works like a charm!!


Here is another macro (a non-looping one) for you to try...

Code:
Sub FillInBlanks()
  On Error GoTo NoBlanks
  With Range("B3:D" & Cells(Rows.Count, "A").End(xlUp).Row)
    .SpecialCells(xlBlanks).FormulaR1C1 = "=R[-1]C"
    .Value = .Value
  End With
NoBlanks:
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,463
Messages
6,124,963
Members
449,200
Latest member
indiansth

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