auto fill the last cell of the column with destination range

gkisacik

New Member
Joined
Oct 29, 2018
Messages
24
Hi,

I am trying to create new reference number and add the last empty cell of Column M: How can i fix this code at destination range??

A2018-01
A2018-02
D2018-03
A2018-04
A2018-05
A2018-06
A2018-07
D2018-08
D2018-09
A2018-10
A2018-11
A2018-12
empty cell here (for instance)

i tried to run macro and got the following;

Code:
Range("M1").Select
Selection.End(xlDown).Select
Selection.AutoFill Destination:=Range("M30:M31"), Type:=xlFillDefault
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
How about
Code:
With Range("M1").End(xlDown)
   .AutoFill Destination:=.Resize(2), Type:=xlFillDefault
End With
 
Upvote 0
hi, thanks for quick reply,

i got an error message at line .AutoFill Destination:=.Resize(2), Type:=xlFillDefault saying object is not recognized
 
Upvote 0
Did you use the entire code I posted, or modify yours?
 
Upvote 0
Which of the two are you say Yep too?
 
Upvote 0
Which of the two are you say Yep too?
oeps sorry i meant i used the entire of yours. it is still new form.

Code:
Private Sub cmdaddnew_Click()

Unload Me
Dim wsuser As Worksheet
frmbrief.txtowner.Text = lbowner.Caption
Set wsuser = Worksheets("Users")
With Range("M1").End(xlDown)
   .AutoFill Destination:=.Resize(2), Type:=xlFill
End With


frmbrief.txtprojectno.Text = ActiveCell.Value

End Sub
 
Upvote 0
Do you want this to work on the "Users" sheet, or the active sheet?
 
Upvote 0

Forum statistics

Threads
1,225,344
Messages
6,184,386
Members
453,229
Latest member
Piip

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