Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default Using an iputted array across multiple worksheets

Hi, I've made a macro that ask for the user to select a range through the
message box, which then uses that range to calculate the sum of it and put it
on another workbook. This part works as expected. But what I'm trying to do
after that is use that same range (such as U51:U55) on another worksheet to
do the same thing. I'm sure I'm doing something stupid but I just can't find
anything that will let me do this. Here is pieces of the code:

On Error Resume Next
Set prevRow = Application.InputBox(Prompt:="Please select the range to
reference", Title:="Range selection", Type:=8)
On Error GoTo 0
If prevRow Is Nothing Then Exit Sub

moveIN = WorksheetFunction.Sum(prevRow)

This part works fine. I just need to do how to use that range on another
worksheet.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Using an iputted array across multiple worksheets

Maybe like this...

NextIN = WorksheetFunction.Sum(Worksheets("Sheet1").Range(p revRow.Address))

where you would change my Sheet1 example name to the actual name of your
worksheet.

--
Rick (MVP - Excel)


"Harry" wrote in message
...
Hi, I've made a macro that ask for the user to select a range through the
message box, which then uses that range to calculate the sum of it and put
it
on another workbook. This part works as expected. But what I'm trying to
do
after that is use that same range (such as U51:U55) on another worksheet
to
do the same thing. I'm sure I'm doing something stupid but I just can't
find
anything that will let me do this. Here is pieces of the code:

On Error Resume Next
Set prevRow = Application.InputBox(Prompt:="Please select the range to
reference", Title:="Range selection", Type:=8)
On Error GoTo 0
If prevRow Is Nothing Then Exit Sub

moveIN = WorksheetFunction.Sum(prevRow)

This part works fine. I just need to do how to use that range on another
worksheet.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Using an iputted array across multiple worksheets

See sample code - specifiy correct sheet name as required.

Sub test123()
Dim prevrow As Range
Dim moveIn As Double
On Error Resume Next
Set prevrow = Application.InputBox(Prompt:="Please select the
range to reference", Title:="Range selection", Type:=8)
On Error GoTo 0
If prevrow Is Nothing Then Exit Sub


moveIn = WorksheetFunction.Sum(prevrow)
Debug.Print "moveIn:", moveIn
Debug.Print prevrow.Address

moveIn = WorksheetFunction.Sum(Sheets("Other").Range
(prevrow.Address))

Debug.Print "moveIn:", moveIn

End Sub
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
Can a SUMPRODUCT array formula be used across multiple worksheets? Ray Excel Discussion (Misc queries) 0 February 24th 10 06:58 PM
Array across multiple worksheets rda Excel Discussion (Misc queries) 1 April 23rd 08 07:31 PM
Creating new worksheets and appending data from multiple worksheets. Dow Excel Programming 5 March 11th 08 07:04 PM
How do I add multiple values in an array based on multiple hits? Steve in Columbia Excel Discussion (Misc queries) 12 September 10th 07 01:14 AM
Array: Counting multiple values within array Trilux_nogo Excel Worksheet Functions 4 April 16th 07 03:12 AM


All times are GMT +1. The time now is 03:42 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"