Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA compy base on range
Hi there,
I'm using Excel 2003 and I created a Function Function MyRange() As Integer MyRange = Worksheets("Sheet1").Range("A1") - Worksheets("Sheet1").Range("A2") MsgBox ("The Range is: ") & MyRange End Function Now A1 = 30 and A2 = 20 so 30-20=10 Then I want to compy 10 rows base on this results How do I call MyRange function with my new Sub Thanks, Ed Dror Andrew Lauren |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA compy base on range
If you wanted to copy from (example) A1 to row B10:
Cells(1, 1).Resize(MyRange, 2).copy Ed Dror wrote: Hi there, I'm using Excel 2003 and I created a Function Function MyRange() As Integer MyRange = Worksheets("Sheet1").Range("A1") - Worksheets("Sheet1").Range("A2") MsgBox ("The Range is: ") & MyRange End Function Now A1 = 30 and A2 = 20 so 30-20=10 Then I want to compy 10 rows base on this results How do I call MyRange function with my new Sub Thanks, Ed Dror Andrew Lauren |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA compy base on range
Ed,
I am little unsure what you are trying to do here? Do you want to look at the values in A1 and A2 and then subtract A1 value from A2 to give you the number of rows you want to copy. Where do you want to copy these 10 rows from eg: what row do you want to start with eg: do you want copy the 10 rows from the row number of the A1 value and then down for the next (A2-A1) rows? or something else? sorry if this is little confusing ...but I am just trying to work out what you are trying to achieve here. Ed Dror wrote: Hi there, I'm using Excel 2003 and I created a Function Function MyRange() As Integer MyRange = Worksheets("Sheet1").Range("A1") - Worksheets("Sheet1").Range("A2") MsgBox ("The Range is: ") & MyRange End Function Now A1 = 30 and A2 = 20 so 30-20=10 Then I want to compy 10 rows base on this results How do I call MyRange function with my new Sub Thanks, Ed Dror Andrew Lauren |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA compy base on range
Hi Ed,
Did Steve's understanding and suggestion help you? If there is any misunderstanding, can you provide more detailed information about what you are trying to do? I am glad to be of assistance. Thanks! Best regards, Peter Huang Microsoft Online Community Support ================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA compy base on range
Hi there,
You can see from this answer Thanks, Ed ""Peter Huang" [MSFT]" wrote in message ... Hi Ed, Did Steve's understanding and suggestion help you? If there is any misunderstanding, can you provide more detailed information about what you are trying to do? I am glad to be of assistance. Thanks! Best regards, Peter Huang Microsoft Online Community Support ================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA compy base on range
Hi Ed,
Thanks for your reply and I am sorry I may have confusion in my last post. I writing the last post to check the status of the issue, it seems that steve_briz have raised some questions and acampbell012 has given a reply based on his understanding. I am also confused by the question, so can you post some detailed information about what you are trying to do? Actually to call a function from another Sub is simply as below. But I am confused by the sentence "Then I want to compy 10 rows base on this results". Sub Test() MyRange End Sub Function MyRange() As Integer MyRange = Worksheets("Sheet1").Range("A1") - Worksheets("Sheet1").Range("A2") MsgBox ("The Range is: ") & MyRange End Function So if you have any concern on this issue, please feel free to let me know and I am happy to of assistance. Best regards, Peter Huang Microsoft Online Community Support ================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Help summing a range base on a date | Excel Worksheet Functions | |||
Change color of font base on time range | Excel Discussion (Misc queries) | |||
Counting cells base on a predetermined range | Excel Worksheet Functions | |||
select a range base on Column A | Excel Programming | |||
macro to set printer range base on the word subtotal | Excel Programming |