PC Review


Reply
Thread Tools Rate Thread

[Beginner's] Increasing numbers in a table

 
 
pnumminen
Guest
Posts: n/a
 
      7th Mar 2009
Please give full code for a macro that gives the user a user-friendly
way to determine a number, then makes this number the value of a
certain cell and increases the number for a certain range of cells,
like this:

http://img136.imageshack.us/img136/8185/numbers.gif

Thanks!
 
Reply With Quote
 
 
 
 
CurlyDave
Guest
Posts: n/a
 
      7th Mar 2009
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("B11").FormulaR1C1 = "=RC[-1]+20"
Range("A11").AutoFill Destination:=Range("A120"),
Type:=xlFillDefault
End Sub

 
Reply With Quote
 
pnumminen
Guest
Posts: n/a
 
      8th Mar 2009
On 7 Mar, 17:12, CurlyDave <davesex...@gmail.com> wrote:
> 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("B11").FormulaR1C1 = "=RC[-1]+20"
> * * Range("A11").AutoFill Destination:=Range("A120"),
> Type:=xlFillDefault
> End Sub


Actually, that doesn't work - "Syntax error".
 
Reply With Quote
 
bigjohn
Guest
Posts: n/a
 
      8th Mar 2009

"pnumminen" <(E-Mail Removed)> ha scritto nel messaggio
news:17d99667-b5c2-4331-9c67-(E-Mail Removed)...
On 7 Mar, 17:12, CurlyDave <davesex...@gmail.com> wrote:
> 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("B11").FormulaR1C1 = "=RC[-1]+20"
> Range("A11").AutoFill Destination:=Range("A120"),
> 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("B11").FormulaR1C1 = "=RC[-1]+20"
Range("A11").AutoFill Destination:=Range("A120"), Type:=xlFillDefault
'<== change this line
End Sub

Look to the sintax at commented row (before last row).
Regards,
John


 
Reply With Quote
 
CurlyDave
Guest
Posts: n/a
 
      9th Mar 2009
On Mar 8, 9:03*am, pnumminen <p.nummi...@suomi24.fi> wrote:
> On 7 Mar, 17:12, CurlyDave <davesex...@gmail.com> wrote:
>
> > 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("B11").FormulaR1C1 = "=RC[-1]+20"
> > * * Range("A11").AutoFill Destination:=Range("A120"),
> > 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.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Modifing Cells- Increasing numbers in a table =?Utf-8?B?SmlmZnk=?= Microsoft Access External Data 1 22nd May 2004 09:17 AM
Modifing Cells- Increasing numbers in a table =?Utf-8?B?SmlmZnk=?= Microsoft Access VBA Modules 2 22nd May 2004 08:26 AM
Modifing Cells- Increasing numbers in a table =?Utf-8?B?SmlmZnk=?= Microsoft Access Forms 2 22nd May 2004 07:49 AM
Modifing Cells- Increasing numbers in a table =?Utf-8?B?SmlmZnk=?= Microsoft Access 1 22nd May 2004 07:08 AM
Modifing Cells- Increasing numbers in a table =?Utf-8?B?SmlmZnk=?= Microsoft Access Macros 1 22nd May 2004 05:33 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:07 AM.