Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 129
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 195
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 225
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 225
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help summing a range base on a date VinceW Excel Worksheet Functions 3 October 28th 09 10:16 PM
Change color of font base on time range deathzorro Excel Discussion (Misc queries) 2 January 10th 06 07:58 AM
Counting cells base on a predetermined range [email protected] Excel Worksheet Functions 1 November 16th 05 07:40 PM
select a range base on Column A JUAN Excel Programming 3 July 27th 04 07:49 PM
macro to set printer range base on the word subtotal sean Excel Programming 1 January 27th 04 06:30 PM


All times are GMT +1. The time now is 03:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"