Ned help with Fill

Sean15

Well-known Member
Joined
Jun 25, 2005
Messages
698
Office Version
  1. 2010
Platform
  1. Windows
Hi:

I need to fill a large worksheet as follows:
all blank rows that follows a cell with a value should be filled with that cell value.
For example in column C below, C5, C6, C7 should be filled with value in C4.
Value in C8 must stay as is but C11, CC12 must be filled with value in C8

The same will apply to column D, E and F

Could someone help please?



Excel 2010
CDEF
2CheckDateAcctName
336632907/27/1863358John Peter
436657008/24/1863358John Peter
5
6
7
836128903/24/17467Mike James
9
1036136103/31/1763404Joan Yell
11
12
13Required values:
14CheckDateAcctName
1536632907/27/1863358John Peter
1636657008/24/1863358John Peter
1736657008/24/1863358John Peter
1836657008/24/1863358John Peter
1936657008/24/1863358John Peter
2036128903/24/17467Mike James
2136128903/24/17467Mike James
2236136103/31/1763404Joan Yell
Sheet2
 
Hi ,

Make a name range and then use the code below. Error can come in case first cell is empty too (Hope that wont be an issue in you case)

Sub test()
For Each cl In ActiveSheet.Range("rngtest")
If cl.Value = "" Then
cl.Value = cl.Offset(-1).Value

End If
Next




End Sub
 
Upvote 0

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Hi:

I did TRIM(CLEAN) on columns E & F (data range in post#1). Also there are no formulas in data range. Code in post#6 is still producing results listed in post #7 .

Code in post#4 – I just realized it needs to fill data in row 11. So Peter_SS is correct. I did not tell how far to fill the values. So I’ll steal Peter_SS’s idea that we should use data elsewhere in my sheet to determine where the fill should go to. Let’s use column G because it will never contains any blank cells (up to my data range which changes frequently).

Below are the headers of my real data. Could you amend your code to suit?



Excel 2010
BCDEFGHIJKLM
1Check history
21 of 1
3
49/21/2018 2:43 PM
5XXXXX
6
7
8
9CheckDateAcctNameInvoiceInvoice descriptionCheck statusInvoice amountCheck amount
Test filldownplease code


Thanks very much

Regards,

Sean
 
Last edited:
Upvote 0
It is not clear where you want data filled.
Initially you showed us columns C:F with headers in row 2. Now you are showing columns B:M with headers in row 9.
Please clarify which screen shot we should be looking at and what columns and rows we should be looking in for blanks to fill.
 
Upvote 0
Try this:
Uses Column G as last Row like you mentioned in last post:
Code:
[LEFT][COLOR=#333333][FONT=monospace]Sub Filldown_Please()
'Modified 9/30/2018 9:54 PM  EDT
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "G").End(xlUp).Row
For i = 3 To Lastrow
    If Cells(i, "C").Value = "" Then Cells(i, "C").Resize(, 4).Value = Cells(i, "C").Offset(-1).Resize(, 4).Value
Next
Application.ScreenUpdating = True
End Sub[/FONT][/COLOR][/LEFT]


I modified this for you.

You should be able to read code and see Lastrow:
And see I used G
Next time you should now know how to modify that.
 
Upvote 0

Forum statistics

Threads
1,215,410
Messages
6,124,755
Members
449,187
Latest member
hermansoa

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