Auto fill macro for 2 x cols only .

Sunline

Well-known Member
Joined
Oct 6, 2007
Messages
697
Hello all ,
can someone point me to a simple macro that can auto fill 2 x cols at once , or one if that's not possible .

I have data in cols F and G and just want to fill down to end of sheet just as a normal auto fill function would operate .

Have looked at previous thread answers but all were not basic enough , thanks .
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
19,342
Office Version
  1. 2021
Platform
  1. Windows
You said:
fill down to end of sheet

Fill what down?
You do realize a sheet has 1.5 million rows.
You want to fill down that far with what?
 
Upvote 0

igold

Well-known Member
Joined
Jul 8, 2014
Messages
3,222
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
The basic line of code would be something like this. You have to know or tell us how many rows. This one line would fill the formulas that are in Cells F2 and G2 down to Cells F20 and G20.
VBA Code:
Range("F2:G2").AutoFill Range("F2:G20")
 
Upvote 0

Sunline

Well-known Member
Joined
Oct 6, 2007
Messages
697
Hi , sorry I didn't explain well , here goes . Hopefully sheet is enclosed .
Col F has numbers .
Col G has text .
They start on row 2 and then gaps , so fill down until next row , find next different numbers and text then fill those and repeat to end of sheet where ID ends .
Thanks .
 
Upvote 0

igold

Well-known Member
Joined
Jul 8, 2014
Messages
3,222
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
No sheet that I see. Could you post some sample data real or fictitious. If you use XL2BB that would the best way.
 
Upvote 0

Sunline

Well-known Member
Joined
Oct 6, 2007
Messages
697
Yes trying too , struggling to find my sheet , have downloaded XL2BB , but cant get it from clipboard to here , will keep trying .
 
Upvote 0

Sunline

Well-known Member
Joined
Oct 6, 2007
Messages
697
Ok finally .
Auto fill macro.xlsm
AFG
1IDTab#Horse
211SPIRITUALISED QTIS Bonus Scheme
32
43
54
65
76
87
98
109
1110
1211
1312
1413
1514
1615
1716
1817
1918
2019
2120
2221
2322
2423
2524
2625
2726
2827
2928
30292HANG FIVE
3130
3231
3332
3433
3534
3635
3736
3837
3938
4039
4140
4241
4342
4443
4544
4645
4746
4847
4948
5049
5150
5251
5352
5453
5554
5655
5756
5857
5958
6059
61603MISHANI PERSUASION QTIS Bonus Scheme
6261
6362
6463
6564
6665
6766
6867
6968
7069
7170
7271
7372
7473
7574
7675
7776
7877
7978
8079
8180
8281
8382
8483
8584
8685
8786
8887
8988
9089
9190
9291
9392
9493
9594
9695
9796
9897
99984ALERT STATE QTIS Bonus Scheme
10099
101100
102101
103102
104103
105104
106105
107106
108107
109108
110109
111110
112111
113112
114113
115114
116115
117116
118117
119118
120119
121120
122121
123122
124123
125124
126125
127126
128127
1291285DEMON DELIVERA
130129
131130
132131
133132
134133
135134
136135
137136
138137
139138
140139
141140
142141
143142
144143
145144
146145
1471466SIR LEONIDAS
148147
149148
150149
151150
152151
153152
154153
155154
156155
157156
158157
159158
160159
161160
162161
163162
164163
165164
166165
167166
168167
169168
170169
171170
172171
173172
174173
175174
1761751STUBAI
177176
178177
179178
SHEET1
 
Upvote 0

igold

Well-known Member
Joined
Jul 8, 2014
Messages
3,222
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
In the data you provided what values would you expect to show in Cells F3,G3 and F4, G4.
 
Upvote 0

Sunline

Well-known Member
Joined
Oct 6, 2007
Messages
697
F3 result 1
F4 result 1 etc

G3 result SPIRITUALISED QTIS Bonus Scheme
G4 result SPIRITUALISED QTIS Bonus Scheme etc

Until next number/text is found this would be
2 HANG FIVE

Repeat auto fill as in the same manner as G3 and G4 were resulted .

 
Upvote 0

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
21,514
Office Version
  1. 365
  2. 2007
Platform
  1. Windows
how about
VBA Code:
Sub fild()
With Range("F:G")
    .SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=R[-1]C"
    .Value = .Value
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,186,639
Messages
5,958,928
Members
438,384
Latest member
RedJeep1970

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
Top