Hello,
I know what Type Mismatch means, but I haven't been able to figure out the cause of the Type Mismatch error I am getting for this line of code:
Name1(s) = CurCell.Offset(s, 2)
In the Immediate Window, I get a Vendor Name for CurCell.Offset(s,2) and I Dimmed Name1 As Variant (for an Array), so that seems to be sufficient to me, but I nevertheless get the "Type Mismatch" error. Can you point me in the right
direction?
Public Sub Analyze()
Dim WSA As Worksheet: Set WSA = Worksheets("Sheet1")
Dim s As Integer, Z As Integer, CurCell As Variant, Name1 As Variant, Name2 As Variant, Address As Variant
Dim City As Variant, State As Variant, Zip As Variant, Box7AMt As Variant, Submittor As Variant
LastRowA = Cells(Rows.Count, 1).End(xlUp).Row
For Counter = 2 To LastRowA
Set CurCell = WSA.Cells(Counter, 3)
If CurCell.Offset(1, 0) <> CurCell Then
'curCell row should remain as it is
ElseIf CurCell = CurCell.Offset(1, 0) Then
Z = 1
Do Until CurCell <> CurCell.Offset(Z, 0)
Z = Z + 1
Loop
For s = 0 To Z - 1
Name1(s) = CurCell.Offset(s, 2)
Name2(s) = CurCell.Offset(s, 3)
Address(s) = CurCell.Offset(s, 4)
City(s) = CurCell.Offset(s, 5)
State(s) = CurCell.Offset(s, 6)
Zip(s) = CurCell.Offset(s, 7)
Box7AMt(s) = CurCell.Offset(s, 16)
Submittor(s) = CurCell.Offset(s, 17)
Next s
End If
Next Counter
End Sub
Display More