Autofill last row

ai1094

Board Regular
Joined
Aug 23, 2018
Messages
92
I have part of my VBA code below:

Range("W82:X88").Select
Selection.AutoFill Destination:=Range("W82:X5500")
Range("W82:X5500").Select


How can I make the selected range autofill to the last row? Data may contain more or less than 5,500 entries and I would like to make the code more dynamic.
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
How can I make the selected range autofill to the last row?
How do we determine the last row?
Is there a particular column that we could always use to determine that?

Also, can you tell us a bit about what is in W82:X88 and why you are using 7 rows to Autofill?
 
Last edited:
Upvote 0
Last row can be determined by Column A.

Also, I have formulas in W82 and X82, however the next 6 cells after Row 82 equal the cell above it.
For example:

Col W
=VLOOKUP Formula
=W82
=W83
=W84
=W85
=W86
=W87

The same formulas then apply for the next 7 rows. Column X follows the same logic. Is this a little more clear?

How do we determine the last row?
Is there a particular column that we could always use to determine that?

Also, can you tell us a bit about what is in W82:X88 and why you are using 7 rows to Autofill?
 
Last edited:
Upvote 0
Does this do what you want?

Code:
Sub Fill_Em()
  Range("W82:X88").AutoFill Destination:=Range("W82:X" & Range("A" & Rows.Count).End(xlUp).Row)
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,952
Messages
6,175,595
Members
452,656
Latest member
earth

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