![]() |
having probelms getting my loop to terminate on an array value read from an empty cell
This is my data stored in a column.
Team 1 Team 2 Team 3 Team 4 QC I read in the data using Do Until iempty = 5 ' get names of teams If IsEmpty(Worksheets("teams").Range("A" & irow)) Then iempty = iempty + 1 irow = irow + 1 Else Teamnames(iteam) = Worksheets("teams").Range("A" & irow) irow = irow + 1 iteam = iteam + 1 iempty = 1 If icount = 100 Then Exit Sub End If End If Loop The data reads in correctly and I am able to write it to another column. I have tried to terminate the below do until loop using Null, "", vbNull, 0 or using an IsEmpty(teamnames(iteam)) Do Until Teamnames(iteam) = "" nothing works. without the exit sub command, I get into an infinite loop. can anyone please help? Do Until Teamnames(iteam) = vbNull icount = icount + 1 iteam = iteam + 1 MsgBox "teamnames(iteam)= " & Teamnames(iteam) & " iteam = " & iteam If iteam = 10 Then Exit Sub End If Loop |
having probelms getting my loop to terminate on an array value read from an empty cell
Normally, dimensioning the arry creates empty placeholders, but if you fill
them all, there should be no empties. So how about Do Until Isempty (Teamnames(iteam)) Or _ iteam UBound(Teamnames) -- HTH RP (remove nothere from the email address if mailing direct) "mizcrab" wrote in message ups.com... I appreciate the quick response. I tried IsEmpty(Teamnames(iteam)) and it did not work. Do i need to intialize my array to use isempty? isempty worked when I was reading in my data and looking for empty cells. thanks |
having probelms getting my loop to terminate on an array value read from an empty cell
I found a solution. I had dimensioned the array as teamnames As string
* 50, so it was initilializing my array with 50 spaces. it works now that I took out the *50 |
having probelms getting my loop to terminate on an array value read from an empty cell
thanks again for your help, RP
|
All times are GMT +1. The time now is 08:55 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com