|
-
Feb 9th, 2006, 05:23 PM
#1
Thread Starter
Member
[RESOLVED] Range question, robdog maybe you can help
I have another syntax question for you... and thanks by the way for helping me the other day, the program is working excellent! Anyway, to my new question.
Cell A1 contains the integer 5
Cell A2 contains the integer 9
Then I have in a module:
sub store_number()
Dim number as Integer
number = 500
Sheets("sheet1").Range("A1,A2").Value = number
end sub
Basically I'm trying to store the value of number in cell [A1,A2], but can't get the syntax and i've been trying to figure this out for about 30mins, and I have no book to help me out.
PS. heres a link to what I was working on, it's in a zip. Load the .xll file as one of your addins then open the acceldevel.xls. Hope ya like it.
http://stillwaterit.com/stuff.zip
Last edited by kleen00; Feb 9th, 2006 at 09:28 PM.
-
Feb 9th, 2006, 05:39 PM
#2
Re: Range question, robdog maybe you can help
Change
VB Code:
Sheets("sheet1").Range("A1,A2").Value = number
to
VB Code:
Sheets("sheet1").Range("A1:A2").Value = number
I.e. change the comma to a colon.
Declan
Don't forget to mark your Thread as resolved.
Take a moment to rate posts that you think are helpful 
-
Feb 9th, 2006, 05:47 PM
#3
Thread Starter
Member
Re: Range question, robdog maybe you can help
Cool. Thanks DKenny.
Ok one more. =)
-----
number = 500
row = Sheets("pre").Range("A1").Value
col = Sheets("pre").Range("B1").Value
Sheets("sheet1").Range("[col,row]").Value = number
-----
So now row = A1 = 5 and col = B1 = 9, and I want to store 'number' in col 5, row 9. How do I do that?
-
Feb 9th, 2006, 05:50 PM
#4
Re: Range question, robdog maybe you can help
VB Code:
Sheets("sheet1").Cells(Row, col).Value = Number
Declan
Don't forget to mark your Thread as resolved.
Take a moment to rate posts that you think are helpful 
-
Feb 9th, 2006, 06:00 PM
#5
Thread Starter
Member
Re: Range question, robdog maybe you can help
wow that was simple. Thanks again!!!!
-
Feb 9th, 2006, 06:02 PM
#6
Re: Range question, robdog maybe you can help
No worries.
Don't forget to mark this thread as complete - if your issue is resolved.
Declan
Don't forget to mark your Thread as resolved.
Take a moment to rate posts that you think are helpful 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|