Fill Down Macro with Varying Rows and Columns

x33166

New Member
Joined
Aug 20, 2018
Messages
3
I've looked everywhere and maybe I just wasn't wording my search properly but I cannot find a solution to a problem I have on a daily basis. I'm looking for a macro that will do the following:


CodeNamerateTotal
atim1.052
3
4
bob5
6
2.017
b8
9
10
jim11
12
13
chris3.55214
15
16
17
d18
19
20
21
722
23
Ralph24
25
26
27
28
29
30
31
32
c33
34
35
v36
37
38
39
40
41
42
43
x44
45
46

<colgroup><col width="64" span="4" style="width:48pt"> </colgroup><tbody>
</tbody>
The above sample data set (each time the number of rows and columns will be different but the last column will always have a value in every row so the last column should be used to stop the fill down and row 1 will always be a header row so start fill down with data in row 2) I would like the solution to look like:

CodeNamerateTotal
atim1.052
atim1.053
atim1.054
abob1.055
abob1.056
abob2.017
bbob2.018
bbob2.019
bbob2.0110
bjim2.0111
bjim2.0112
bjim2.0113
bchris3.55214
bchris3.55215
bchris3.55216
bchris3.55217
dchris3.55218
dchris3.55219
dchris3.55220
dchris3.55221
dchris722
dchris723
dRalph724
dRalph725
dRalph726
dRalph727
dRalph728
dRalph729
dRalph730
dRalph731
dRalph732
cRalph733
cRalph734
cRalph735
vRalph736
vRalph737
vRalph738
vRalph739
vRalph740
vRalph741
vRalph742
vRalph743
xRalph744
xRalph745
xRalph746


<colgroup><col width="64" span="4" style="width:48pt"> </colgroup><tbody>
</tbody>

I hope this all makes sense. Appreciate any assistance
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Hi & welcome to MrExcel.
How about
Code:
Sub Fillme()
   With Range("A3", Range("D" & Rows.count).End(xlUp).Offset(, -1))
      .SpecialCells(xlBlanks).FormulaR1C1 = "=r[-1]c"
      .Value = .Value
   End With
End Sub
 
Upvote 0
Thanks for your quick reply. It works if column D is my last column but that won't always be the case. Each data set will vary by number of rows and columns. So column might be the last column or it could be column AB.
 
Upvote 0
Ok, how about
Code:
Sub Fillme()
   Dim Lc As Long
   Lc = Cells(1, Columns.count).End(xlToLeft).Column
   With Range("A3", Cells(Rows.count, Lc).End(xlUp).Offset(, -1))
      .SpecialCells(xlBlanks).FormulaR1C1 = "=r[-1]c"
      .Value = .Value
   End With
End Sub
 
Upvote 0
AWESOME!!!! Thank you so much and again for responding so quickly. You have no idea how much time you're going to save me. I will be using this daily.
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,849
Messages
6,121,922
Members
449,056
Latest member
denissimo

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