![]() |
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 |
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 |
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 |
All times are GMT +1. The time now is 01:32 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com