I have a macro that was created to double a number in a speadsheet. How can I use this macro to triple a number?
Example would be ....
245
245
245
246
246
246
247
247
247
Here is the macro that I have.....
Sub doublenum()
Dim X As Long
Dim rn As Long
Dim cn As String
Dim sn As Long
cn = InputBox("Enter the column letter you want to populate.")
rn = InputBox("Enter the number of rows you want to populate (Remember this doubles - example if you say 10 it will give you 20 rows).")
sn = InputBox("What row do you want to start with?")
X = InputBox("What number do you want to start counting at?")
Application.ScreenUpdating = False
Application.StatusBar = "Macro Running"
X = X
Range(cn & sn).Select
Do Until ActiveCell.Row = rn + sn
If ActiveCell.EntireRow.Hidden = False Then
ActiveCell.Value = X
X = X + 1
End If
ActiveCell.Offset(1).Select
Loop
Dim lr As Long
lr = Range(cn & Rows.Count).End(xlUp).Row
Dim i As Long
For i = lr To sn + 1 Step -1
Range(cn & i).EntireRow.Insert
Next i
lr = Range(cn & Rows.Count).End(xlUp).Row
For i = 2 To lr
If Range(cn & i) = "" Then Range(cn & i) = Range(cn & i - 1)
Next i
Application.ScreenUpdating = True
Application.StatusBar = "Completed"
End Sub
Thanks in advance.
Bookmarks