Autofill Numbers in Sequence, increments of 30 over multiple columns

Plukey

Board Regular
Joined
Apr 19, 2019
Messages
138
Office Version
  1. 2016
Platform
  1. Windows
I have a few VBA's that accomplish the task on a single column. But what Id like to do, is enter a start number and consecutively autofill 270 times across 9 columns in increments of 30.
These Serial Numbers get used quickly, If I could run a Vba that ask for a start # and autofill it would save some time.

Ex.
1 6 11
2 7 12
3 8 13
4 9 14
5 10 15
etc...….

VBA Code:
Sub AddSerialNum1()
Dim i As Integer
On Error GoTo Last
i = InputBox("Enter Value", "Enter Serial Numbers")
For i = 1 To i
ActiveCell.Value = i
ActiveCell.Offset(1, 0).Activate
Next i
Last:
Exit Sub
End Sub


or


VBA Code:
Sub AddSerialNum2()
Dim i As Long, J As Long
Application.ScreenUpdating = 0

i = Application.InputBox(Prompt:="Start", Type:=1)
J = Application.InputBox(Prompt:="end", Type:=1)
With Sheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Offset(1)
        .Value = i
        .AutoFill .Resize(J, 1), xlFillSeries
    End With
    Application.ScreenUpdating = 1


End Sub
 
that's great ! but what I if choose specific columns (A,C,F,L,M) how should be ?
Those columns would not really qualify as "all columns" now, would it? Any way, try this...
VBA Code:
Sub RemoveRowMatchingNumbers()
  Dim Rng As Range
  For Each Rng In Range("A1,C1,F1,L1,M1")
    Rng.Resize(30).Value = [ROW(1:30)]
  Next
End Sub
 
Upvote 0

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Forum statistics

Threads
1,215,011
Messages
6,122,680
Members
449,091
Latest member
peppernaut

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