Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default working with multiple ranges


right now, i have something like this:


Code:
--------------------
shDER.Range("C7:C368").Value = Range("LIST").Value
shHum.Range("C7:C368").Value = Range("LIST").Value
shTRI.Range("C7:C368").Value = Range("LIST").Value
shOOS.Range("C7:C368").Value = Range("LIST").Value
--------------------


is there a more elegant way of doing this, perhaps all in one line? all
i'm doing is changing the sheet.

thanks.


--
dreamz
------------------------------------------------------------------------
dreamz's Profile: http://www.excelforum.com/member.php...o&userid=26462
View this thread: http://www.excelforum.com/showthread...hreadid=532989

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default working with multiple ranges

Because the four ranges seems to be in four differnt worksheets and there are
only 4 sheets, I think your current code is already reasonably clean enough.

You may consider putting the sheet names into an array, and then use a for
next loop to assign values to those four sheets. However, it will properly
require more than 4 lines. But that will be a better approach if you got
really a lot of sheets to manipulate.

Regards,
Edwin Tam

http://www.vonixx.com



"dreamz" wrote:


right now, i have something like this:


Code:
--------------------
shDER.Range("C7:C368").Value = Range("LIST").Value
shHum.Range("C7:C368").Value = Range("LIST").Value
shTRI.Range("C7:C368").Value = Range("LIST").Value
shOOS.Range("C7:C368").Value = Range("LIST").Value
--------------------


is there a more elegant way of doing this, perhaps all in one line? all
i'm doing is changing the sheet.

thanks.


--
dreamz
------------------------------------------------------------------------
dreamz's Profile: http://www.excelforum.com/member.php...o&userid=26462
View this thread: http://www.excelforum.com/showthread...hreadid=532989


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default working with multiple ranges

dreamz,

Sub Test()
Dim ws As Worksheet

For Each ws In Worksheets(Array("shDER", "shHum", "shTRI", "shOOS"))
ws.Range("C7:C368").Value =Range("LIST").Value
Next ws
End Sub

You should also qualify your from Range so that it looks somehting like:
Worksheet("Foo").Range("LIST").Value

hth,

Doug

"dreamz" wrote in
message ...

right now, i have something like this:


Code:
--------------------
shDER.Range("C7:C368").Value = Range("LIST").Value
shHum.Range("C7:C368").Value = Range("LIST").Value
shTRI.Range("C7:C368").Value = Range("LIST").Value
shOOS.Range("C7:C368").Value = Range("LIST").Value
--------------------


is there a more elegant way of doing this, perhaps all in one line? all
i'm doing is changing the sheet.

thanks.


--
dreamz
------------------------------------------------------------------------
dreamz's Profile:
http://www.excelforum.com/member.php...o&userid=26462
View this thread: http://www.excelforum.com/showthread...hreadid=532989



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default working with multiple ranges

I would argue that for four sheets, an array is an unnecessary overhead that
makes the code more difficult to understand.

Leave it as it is.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Doug Glancy" wrote in message
...
dreamz,

Sub Test()
Dim ws As Worksheet

For Each ws In Worksheets(Array("shDER", "shHum", "shTRI", "shOOS"))
ws.Range("C7:C368").Value =Range("LIST").Value
Next ws
End Sub

You should also qualify your from Range so that it looks somehting like:
Worksheet("Foo").Range("LIST").Value

hth,

Doug

"dreamz" wrote in
message ...

right now, i have something like this:


Code:
--------------------
shDER.Range("C7:C368").Value = Range("LIST").Value
shHum.Range("C7:C368").Value = Range("LIST").Value
shTRI.Range("C7:C368").Value = Range("LIST").Value
shOOS.Range("C7:C368").Value = Range("LIST").Value
--------------------


is there a more elegant way of doing this, perhaps all in one line? all
i'm doing is changing the sheet.

thanks.


--
dreamz
------------------------------------------------------------------------
dreamz's Profile:
http://www.excelforum.com/member.php...o&userid=26462
View this thread:

http://www.excelforum.com/showthread...hreadid=532989





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default working with multiple ranges

Thanks Bob.

Doug

"Bob Phillips" wrote in message
...
I would argue that for four sheets, an array is an unnecessary overhead
that
makes the code more difficult to understand.

Leave it as it is.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Doug Glancy" wrote in message
...
dreamz,

Sub Test()
Dim ws As Worksheet

For Each ws In Worksheets(Array("shDER", "shHum", "shTRI", "shOOS"))
ws.Range("C7:C368").Value =Range("LIST").Value
Next ws
End Sub

You should also qualify your from Range so that it looks somehting like:
Worksheet("Foo").Range("LIST").Value

hth,

Doug

"dreamz" wrote in
message ...

right now, i have something like this:


Code:
--------------------
shDER.Range("C7:C368").Value = Range("LIST").Value
shHum.Range("C7:C368").Value = Range("LIST").Value
shTRI.Range("C7:C368").Value = Range("LIST").Value
shOOS.Range("C7:C368").Value = Range("LIST").Value
--------------------


is there a more elegant way of doing this, perhaps all in one line? all
i'm doing is changing the sheet.

thanks.


--
dreamz
------------------------------------------------------------------------
dreamz's Profile:
http://www.excelforum.com/member.php...o&userid=26462
View this thread:

http://www.excelforum.com/showthread...hreadid=532989









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default working with multiple ranges


thanks. at the moment, there are only four sheets, but it's a good idea
that i'll have to use later.


--
dreamz
------------------------------------------------------------------------
dreamz's Profile: http://www.excelforum.com/member.php...o&userid=26462
View this thread: http://www.excelforum.com/showthread...hreadid=532989

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
Sumproduct formula not working with ranges Michelle Excel Discussion (Misc queries) 7 February 10th 09 11:26 AM
working with multiple consolidation ranges. Saraladevi Excel Worksheet Functions 1 September 9th 08 03:17 PM
Working with Ranges...Need help Jitranijam Excel Discussion (Misc queries) 3 October 10th 06 10:45 PM
Working with ranges denny Excel Programming 4 November 12th 05 03:21 PM
Problem Working with Named Ranges montgomerymouse Excel Discussion (Misc queries) 1 January 10th 05 10:45 PM


All times are GMT +1. The time now is 10:32 AM.

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

About Us

"It's about Microsoft Excel"