Creating numberlist using Excel VBA

ApprenticeGirl

New Member
Joined
Jul 15, 2012
Messages
38
Hi everyone I would like to seek your help in creating a a number list base on the last number appear in column A. Number list will be put on Column B1 down.


Here is my example.

Example 1
COLUMN ACOLUMN B
random #1
12
23
44
105
66
77
118
9
10
11
example 2
COLUMN ACOLUMN B
random #1
42
53
6
11
12
15
9
3

<tbody>
</tbody>


Thank you
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Try:-
Code:
[COLOR="Navy"]Sub[/COLOR] MG18Jul58
[COLOR="Navy"]Dim[/COLOR] Lst [COLOR="Navy"]As[/COLOR] long
Lst = Range("A" & Rows.count).End(xlUp).Row
Columns("B:B").ClearContents
[COLOR="Navy"]With[/COLOR] Range("B1")
    .Value = "1"
    .AutoFill Destination:=Range("B1:B" & Range("A" & Lst)), Type:=xlFillSeries
[COLOR="Navy"]End[/COLOR] With
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0
Thanks MickG its working great. Just 1 last request. What if the result will be put in the other sheet? The random# is in sheet1 column A and the result would be place in column E in sheet2.
 
Upvote 0
Disregard my request MickG I already figure out what to do.Thank you very much forgiving a helping hand. Newbie like me is very lucky to have experts like you in this forum.
 
Upvote 0
Try this:-
Code:
[COLOR=navy]Sub[/COLOR] MG18Jul25
[COLOR=navy]Dim[/COLOR] Lst [COLOR=navy]As[/COLOR] [COLOR=navy]Long[/COLOR]
[COLOR=navy]Dim[/COLOR] wS [COLOR=navy]As[/COLOR] Worksheet
Lst = Range("A" & Rows.count).End(xlUp).Row
[COLOR=navy]With[/COLOR] Sheets("Sheet2").Range("E1")
       .Resize(Rows.count).ClearContents
       .Value = "1"
       .AutoFill Destination:=.Resize(Range("A" & Lst)), Type:=xlFillSeries
[COLOR=navy]End[/COLOR] [COLOR=navy]With[/COLOR]
[COLOR=navy]End[/COLOR] [COLOR=navy]Sub[/COLOR]
Regards Mick
Ps:- Just seen your Post, Thanks for the feedback!!
 
Upvote 0

Forum statistics

Threads
1,215,049
Messages
6,122,864
Members
449,097
Latest member
dbomb1414

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