Type Mismatch

G

Guest

Hello. I am having a little problem with this code. Under ideal conditions
it does seem to work just fine. I've found that it seems to bug out when it
reaches a Cell (which the value is to be put in the "Entry" Object) that
happens to be blank. Now as far as I know that shouldn't cause a problem.
The really strange thing is that is gives a "Type Mismatch" error. I figured
It might have a space in there which when I click on the cell and use the
arrow keys to move the cursor through any spaces it doesn't move. I press
delete over the cells and it gets past that one line. So something is in
there but nothing I can find. Is there a way I can get it to pass over these
Not so blank Cells. Or maybe its just a problem with my code. Thank you for
your time. (part of the code is below incase you want a look through it.
The problem areas seem to be in the If statements with the <> "" in them)

Mark



RowNum = 1
Do While (Worksheets("GL Hazard Schedule").Range("B" & RowNum).Value <> "")
Or _
(Worksheets("GL Hazard Schedule").Range("B" & RowNum + 1).Value <>
"")
RowNum = RowNum + 1
Loop
RowNum = RowNum - 1

Set MyRange = Worksheets("GL Hazard Schedule").Range("A3:AI" & RowNum)
RowNum = RowNum - 2

For i = 1 To RowNum
Quotes = 0
MsgBox "fsdfs"
Set Entry = MyCol(MyRange.Range("B" & i))
Do While MyRange.Range("B" & i).Value <> ""
Entry.Zip = MyRange.Range("F" & i).Value
If MyRange.Range("U" & i).Value <> "" Then
Entry.GlLoc = MyRange.Range("Y" & i).Value
Entry.GlHaz = Quotes
If MyRange.Range("AB" & i).Value <> "" Then
Entry.ClassCode = MyRange.Range("AB" & i).Value
End If
If MyRange.Range("AH" & i).Value <> "" Then
Entry.GlPremium = MyRange.Range("AH" & i).Value
End If
If MyRange.Range("AI" & i).Value <> "" Then
Entry.GlPremium = MyRange.Range("AI" & i).Value
End If
End If
Quotes = Quotes + 1
i = i + Quotes
Loop
'MyCol.Add Item:=Entry, Key:=Entry.QuoteID
Next i
 
G

Guest

Nevermind! Im ticked off. I needed to get Values from Column Y and Z. Not
U and Y. U Stored a a string where it was trying to be put into an Integer.
I spent around five or six hours trying to figure out the problem and
deleting every blank I could.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Arrays problem in new filtering code 3
Type Mismatch error 4
Today's Date 1
Overwriting data 10
Every 4th Row 5
Strange cut and paste result between worksheets 6
Adjusting alogarithm 18
Foundcell 2

Top