I'm completely new to VBA and I'm been trying to make basic problems to practice. I just wanna fill a column with sequential numbers from 1 to N. The N number will be a value on an specific cell.
So the N value is on the C4 cell for example is 5 , and I wanna output from B2 - BN = 1,2,3,4,5 I have this code based on kinda similar questions and my knowledge of cycles but I can't make it work...
Sub ejemplo()
Dim total() As Variant
maximo = Range("C4").Value
For i = 1 To maximo
total(i) = i
Next i
total = Application.WorksheetFunction.Transpose(total)
Range("B7:B").Value = total
End Sub
The error that sometimes pop out is "out of range" on the total(i) = i line, I really don't know what's happening...