[Beginner's] Increasing numbers in a table

  • Thread starter Thread starter pnumminen
  • Start date Start date
Try this it does what your example shows

Sub Button1_Click()
Dim s As String
s = InputBox("What is the number")
Range("A1") = s
Range("B1:D1").FormulaR1C1 = "=RC[-1]+20"
Range("A1:D1").AutoFill Destination:=Range("A1:D20"),
Type:=xlFillDefault
End Sub
 
Try this it does what your example shows

Sub Button1_Click()
    Dim s As String
    s = InputBox("What is the number")
    Range("A1") = s
    Range("B1:D1").FormulaR1C1 = "=RC[-1]+20"
    Range("A1:D1").AutoFill Destination:=Range("A1:D20"),
Type:=xlFillDefault
End Sub

Actually, that doesn't work - "Syntax error".
 
"pnumminen" <[email protected]> ha scritto nel messaggio
Try this it does what your example shows

Sub Button1_Click()
Dim s As String
s = InputBox("What is the number")
Range("A1") = s
Range("B1:D1").FormulaR1C1 = "=RC[-1]+20"
Range("A1:D1").AutoFill Destination:=Range("A1:D20"),
Type:=xlFillDefault
End Sub

Actually, that doesn't work - "Syntax error".

Sub Button1_Click()
Dim s As String
s = InputBox("What is the number")
Range("A1") = s
Range("B1:D1").FormulaR1C1 = "=RC[-1]+20"
Range("A1:D1").AutoFill Destination:=Range("A1:D20"), Type:=xlFillDefault
'<== change this line
End Sub

Look to the sintax at commented row (before last row).
Regards,
John
 
Try this it does what your example shows
Sub Button1_Click()
    Dim s As String
    s = InputBox("What is the number")
    Range("A1") = s
    Range("B1:D1").FormulaR1C1 = "=RC[-1]+20"
    Range("A1:D1").AutoFill Destination:=Range("A1:D20"),
Type:=xlFillDefault
End Sub

Actually, that doesn't work - "Syntax error".

Sometimes, when pasting code to the forum, the lines get split, if a
line is in red when you paste the code in the VBA editor, chances are
that the line of code is split and you will have to join it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top