Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Type mismatch problem?

I am having a big problem.

I have the following loop

FlCellCount = 2
IntEnd = 100
Do While newBook.Worksheets(Sh).Cells(FlCellCount, 2) < (IntEnd
1000)
IntSizeCnt = IntSizeCnt + 1
FlCellCount = FlCellCount + 1
Loop

Now everything has worked fine for like a month but I found that thi
is causing problems on a particular data.

I have a book with 2 worksheets and basically this loop will go throug
one of the sheets and check, line by line, which ones are under 100000.

It has worked fine until I tried in a sheet with 4 rows of values, wha
happens is that it'll start looping and keep on going (And not qui
after FlCellCount = 6 since after line 5 the whole sheet is full o
empty cells) until it jumps out of the sub (Instead of going further
and going to the line under the Sub call.

I tried debugging and if I stop the mouse over the "Cells" nothing i
shown (instead of showing the value for that exactly cell).

Now I changed the Cells part to a Range, and now when I stop the mous
over it (Upon debugging) it shows "Type mismatch".

There is nothing wrong with the sheet, column B contains values lowe
than 100000 (First value is 15505 in B2) and as I said it only happen
to a specific sheet, all other sheets I tried (With the exact same kin
of data) works fine and the loop stops upon finding a line with a valu
over 100000 and the sub continues.

Anybody got an idea of what could be happening?

Best Regards

Noo

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 216
Default Type mismatch problem?

Empty cells value is inferior to any numerical positive
value.
If you don't have any numerical value greater than 100000
till you reach empty cells your loop won't finish ever.

Which was exactly the change of "cells" with "range"?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Type mismatch problem?

Thanks, the change was

From: Cells(FlCellCount, 2)

To: Range("B" + FlCellCount)

I am gonna look into the endless loop thing and check for empty a
well.

Will an Empty cell trigger the IsEmpty method or do I have to check fo
""?

Best Regards

Noo

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Type mismatch problem?

Dim sStr as String
FlCellCount = 2
IntEnd = 100
Do While newBook.Worksheets(Sh).Cells(FlCellCount, 2) _
< (IntEnd *1000)
sStr = NewBook.Worksheets(sh).Cells(FlCellcount,2).Text
sStr = Application.Substitute(sStr,chr(160)," ")
if len(Trim(sStr)) = 0 then exit do
IntSizeCnt = IntSizeCnt + 1
FlCellCount = FlCellCount + 1
Loop

--
Regards,
Tom Ogilvy


"NooK " wrote in message
...
Thanks, the change was

From: Cells(FlCellCount, 2)

To: Range("B" + FlCellCount)

I am gonna look into the endless loop thing and check for empty as
well.

Will an Empty cell trigger the IsEmpty method or do I have to check for
""?

Best Regards

NooK


---
Message posted from http://www.ExcelForum.com/



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
Type Mismatch [email protected] Excel Worksheet Functions 1 May 16th 07 03:29 PM
Type mismatch Steve Garman Excel Programming 0 February 5th 04 07:39 AM
Type mismatch Alan Beban[_4_] Excel Programming 0 February 4th 04 08:39 PM
Type Mismatch Phil Hageman[_3_] Excel Programming 2 January 9th 04 06:11 PM


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