Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default having probelms getting my loop to terminate on an array value read from an empty cell

thanks again for your help, RP

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
Help! PRobelms with TODAY()?! Leonhardtk Excel Worksheet Functions 2 August 20th 07 09:38 PM
Loop all sheetsand delete empty rows Sige Excel Programming 2 July 27th 05 12:22 PM
Need VBA code to terminate a find loop mikeburg Excel Programming 2 June 23rd 05 10:06 PM
Empty cells in For Loop Linking to specific cells in pivot table Excel Programming 2 May 16th 05 07:25 PM
The instruction at "0x65255ac9" referenced memory at "0x00000008". The memory could not be read. Clikc OK to terminate etc Angus Comber[_2_] Excel Programming 1 November 7th 03 01:18 PM


All times are GMT +1. The time now is 01:55 PM.

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"