Forum Discussion
Mucho_Elanstrand
Oct 01, 2019Copper Contributor
VBA for autofill
Hi Wizards, Let me first preface this by saying; I know nothing about coding. But in my experience, when you feel there can be a more efficient way to do something, there usually is one. I a...
Smitty Smith
Oct 01, 2019Former Employee
Mucho_Elanstrand How's this:
Sub BuildArray()
Dim i As Long
Dim x As Long
Dim y As Long
x = Application.InputBox("How many columns do you want to fill?", "Column Count", 1, Type:=1)
y = Application.InputBox("How many rows do you want to fill?", "Row Count", 1, Type:=1)
Range("A2:A16").Value = 1
For i = 1 To y
Range(Cells(i, 2), Cells(i, x)).Offset(1).Value = i
Next i
End Sub
Mucho_Elanstrand
Oct 01, 2019Copper Contributor