Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Ayo Ayo is offline
external usenet poster
 
Posts: 489
Default Need help with cells Array

For Each sht In Sheets(Array("NSB West 2008", "NSB West 2009", "NSB East
2008", "NSB East 2009", "NSB Manhattan"))

I am trying to use the line of code below, just like the one above but I am
getting a Method 'Range' of object '_Global' failed. Any ideas?
Thanks.

For Each c In Range(Array("D8", "F8", "H8", "J8", "L8")).Cells
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 913
Default Need help with cells Array

On Thu, 7 Aug 2008 11:44:02 -0700, Ayo
wrote:

For Each sht In Sheets(Array("NSB West 2008", "NSB West 2009", "NSB East
2008", "NSB East 2009", "NSB Manhattan"))

I am trying to use the line of code below, just like the one above but I am
getting a Method 'Range' of object '_Global' failed. Any ideas?
Thanks.

For Each c In Range(Array("D8", "F8", "H8", "J8", "L8")).Cells



Try this instead:

For Each c in Array(Range("D8"),Range("F8"),Range("J8"),Range("L 8"))

Hope this helps / Lars-Åke
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Need help with cells Array

How about making an array of strings and get the Range set from them:

Sub dural()
s1 = "D8,F8,H8,J8,L8"
s2 = Split(s1, ",")
For i = 0 To UBound(s2)
Set c = Range(s2(i))
MsgBox (c.Address)
Next
End Sub



--
Gary''s Student - gsnu200798


"Ayo" wrote:

For Each sht In Sheets(Array("NSB West 2008", "NSB West 2009", "NSB East
2008", "NSB East 2009", "NSB Manhattan"))

I am trying to use the line of code below, just like the one above but I am
getting a Method 'Range' of object '_Global' failed. Any ideas?
Thanks.

For Each c In Range(Array("D8", "F8", "H8", "J8", "L8")).Cells

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default Need help with cells Array


Sub ParisHiltonForPresident()
Dim arr As Variant
Dim c As Variant
Dim rng As Range

arr = Array("D8", "F8", "H8", "J8", "L8")
For Each c In arr
Set rng = Range(c)
MsgBox rng.Text
Next
Set rng = Nothing
End Sub



"Ayo"
wrote in message
For Each sht In Sheets(Array("NSB West 2008", "NSB West 2009", "NSB East
2008", "NSB East 2009", "NSB Manhattan"))
I am trying to use the line of code below, just like the one above but I am
getting a Method 'Range' of object '_Global' failed. Any ideas?
Thanks.

For Each c In Range(Array("D8", "F8", "H8", "J8", "L8")).Cells
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Need help with cells Array

For Each c In Range("D8,F8,H8,J8,L8").Cells



Ayo wrote:

For Each sht In Sheets(Array("NSB West 2008", "NSB West 2009", "NSB East
2008", "NSB East 2009", "NSB Manhattan"))

I am trying to use the line of code below, just like the one above but I am
getting a Method 'Range' of object '_Global' failed. Any ideas?
Thanks.

For Each c In Range(Array("D8", "F8", "H8", "J8", "L8")).Cells


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Need help with cells Array

Ps.

c should be declared as a range:

dim c as range

Dave Peterson wrote:

For Each c In Range("D8,F8,H8,J8,L8").Cells

Ayo wrote:

For Each sht In Sheets(Array("NSB West 2008", "NSB West 2009", "NSB East
2008", "NSB East 2009", "NSB Manhattan"))

I am trying to use the line of code below, just like the one above but I am
getting a Method 'Range' of object '_Global' failed. Any ideas?
Thanks.

For Each c In Range(Array("D8", "F8", "H8", "J8", "L8")).Cells


--

Dave Peterson


--

Dave Peterson
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
meaning of : IF(Switch; Average(array A, array B); array A) DXAT Excel Worksheet Functions 1 October 24th 06 06:11 PM
combining cells and array from different sheets into an array to pass to IRR() [email protected] Excel Discussion (Misc queries) 3 September 11th 06 07:17 AM
adding cells within an array beecher Excel Worksheet Functions 11 August 30th 06 08:29 AM
Can a UDF be used on an array of cells? Paul D. Simon Excel Worksheet Functions 3 September 8th 05 06:23 PM
How do I sum an array of cells, even if some of them are #N/A René Excel Discussion (Misc queries) 5 January 18th 05 02:28 PM


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