vba to autofill

Diving_Dan

Board Regular
Joined
Oct 20, 2019
Messages
161
Hi all,

I'm having a nightmare trying to autofill. I have tried recording a macro to find the solution but it isn't giving me the right answer.

I am wanting to go to the last row with data and then autofill down 1 row. I have come up with the below but it doesn't work properly.

Any help is appreciated as always.

VBA Code:
Cells(Rows.Count, 1).End(xlUp).Select
    
Selection.AutoFill Destination:=Range("A5:A6"), Type:=xlFillDefault
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
65,728
Office Version
  1. 365
Platform
  1. Windows
What do you have in the cell?
 

Diving_Dan

Board Regular
Joined
Oct 20, 2019
Messages
161
It is a mixture of letters and numbers. 11XX/1

It is the number at the end that needs to increase by 1, the 11XX is to stay the same. If i drag down the cell it autofills correctly but can't work out the vba.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
65,728
Office Version
  1. 365
Platform
  1. Windows
Ok, how about
VBA Code:
   With Range("A" & Rows.Count).End(xlUp)
      .AutoFill Range(.Address).Resize(2)
   End With
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
65,728
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback.
 

Forum statistics

Threads
1,147,748
Messages
5,742,971
Members
423,769
Latest member
LongToast

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