Hello, I am trying to search data in column AX but my code keeps giving me the Type Mismatch error anytime I raise the column from AF on the If statement. AF works, AG does not. I'm very confused, please help!
VBA Code:
Sub tester()
Dim wb As Workbook
Dim OVERVIEW As Worksheet
Dim ORDER As Worksheet
Dim j As Long
Dim AnmType As Range
Dim OLrow As Long
Dim OFrow As Long
Dim p As Long
Set wb = ActiveWorkbook
Set OVERVIEW = wb.Sheets("Overview")
Set ORDER = wb.Sheets("BreakDownOrders")
OLrow = ORDER.Cells(ORDER.Rows.Count, "A").End(xlUp).Row
OFrow = ORDER.Cells(2, 1)
p = OVERVIEW.Range("A23")
Set AnmType = ORDER.Range("A2:BB" & OLrow)
For j = 2 To OLrow
' If ORDER.Cells(j, 34).Value = "Whole" And ORDER.Cells(j, 1) = OVERVIEW.Cells(1, 1) Then
If ORDER.Range("AX" & j).Value = "Whole" Then
' OVERVIEW.Cells(p, 1).Value = ORDER.Cells(j, 3).Value
' OVERVIEW.Cells(p, 2).Value = ORDER.Cells(j, 52).Value
' p = p + 1
Else
'next thing
End If
Next j
End Sub