Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default array from range question

i am using this to populate an array
arr = .Range("B12:B" & lRow).Value
then i use this to work with the array
For x = LBound(arr) To UBound(arr)
If arr(x, 1) "" Then

the problem is when lrow = 12 (only 1 element in array), i get a type mismatch.
how can i get around it?
--


Gary



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default array from range question

Hi Gary,

One way, try something like:

Arr = Range("B12:B" & LRow).Value
'then i use this to work with the array
If IsArray(Arr) Then
For x = LBound(Arr) To UBound(Arr)
If Arr(x, 1) "" Then
'do someting,e.g.:
MsgBox Arr(x, 1)

End If
Next x
Else
If Not IsEmpty(Arr) Then
'do something
MsgBox Arr
End If
End If



---
Regards,
Norman



"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
i am using this to populate an array
arr = .Range("B12:B" & lRow).Value
then i use this to work with the array
For x = LBound(arr) To UBound(arr)
If arr(x, 1) "" Then

the problem is when lrow = 12 (only 1 element in array), i get a type
mismatch. how can i get around it?
--


Gary





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default array from range question

i'll give it a shot, norman.
as a temporary fix i just set the lrow to 13 when it = 12, so the client could
enter some data they needed to get in.
thanks

--


Gary


"Norman Jones" wrote in message
...
Hi Gary,

One way, try something like:

Arr = Range("B12:B" & LRow).Value
'then i use this to work with the array
If IsArray(Arr) Then
For x = LBound(Arr) To UBound(Arr)
If Arr(x, 1) "" Then
'do someting,e.g.:
MsgBox Arr(x, 1)

End If
Next x
Else
If Not IsEmpty(Arr) Then
'do something
MsgBox Arr
End If
End If



---
Regards,
Norman



"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
i am using this to populate an array
arr = .Range("B12:B" & lRow).Value
then i use this to work with the array
For x = LBound(arr) To UBound(arr)
If arr(x, 1) "" Then

the problem is when lrow = 12 (only 1 element in array), i get a type
mismatch. how can i get around it?
--


Gary







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
array, range question mwam423 Excel Discussion (Misc queries) 4 August 23rd 07 01:36 AM
copy one array formula to an array range guedj54 Excel Programming 2 October 29th 06 07:38 PM
Question about working with range array 39N 95W Excel Programming 2 January 18th 06 11:49 PM
Tricky array formula issue - Using array formula on one cell, then autofilling down a range aspenbordr Excel Programming 0 July 27th 05 03:59 PM
Range Question / error 1004: method Range of object Worksheet has failed Paul Excel Programming 3 April 7th 05 02:56 PM


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