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

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
What do you have in the cell?
 
Upvote 0
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.
 
Upvote 0
Ok, how about
VBA Code:
   With Range("A" & Rows.Count).End(xlUp)
      .AutoFill Range(.Address).Resize(2)
   End With
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,376
Messages
6,119,174
Members
448,870
Latest member
max_pedreira

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