View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
acw[_2_] acw[_2_] is offline
external usenet poster
 
Posts: 100
Default Code works 1st time then Type Mismatch when checking for not blank cells

Ala

The code seems to be crashing a
Worksheets("Sheet1").Range("B" & n

As you are trying to obtain a boolean response the way the code is structured this item does not provide a boolean. The only boolean response is if column A is longer (or equal to) column B. If B is longer than A then that part of the code will evaluate to the contents of B rather than a boolean. Hence the crash

The code should be (using your structure
If Worksheets("Sheet1").Range("B" & n)< "" Or Worksheets("Sheet1").Range("A" & n) < "" The

Ton


----- Colleyville Alan wrote: ----

"mudraker " wrote in messag
..
Why not do away with your loop and us
ilastrow = oxlWks.Worksheets("Sheet1").Range("A65536").End(xl Up).Ro
this gets the last row with an entry in column
Can not help you as to why your code fail


Thanks - that seems faster and more compact. The code crashing still bug
me! But the goal is to get the thing working

Thanks again