Hi I am Trying to add to cells together and compare them against another cell but I get a type mismatch. first cell is a date, the one being added is a number"as in number of days" and the third one being compared is a date also. but I get type mismatch. my code is below
Sub Macro1()
Macro1 Macro
Dim wks As Worksheet
Set wks = ActiveSheet
Dim x As Integer
Dim p As Integer
Dim rowRange As Range
Dim colRange As Range
Dim LastCol As Long
Dim LastRow As Long
LastRow = wks.Cells(wks.Rows.Count, "A").End(xlUp).Row
Set rowRange = wks.Range("A1:A" & LastRow)
For i = 7 To 189
p = 0
For q = 8 To LastRow
If [aq] = [si] Then
If [cq] + [ui] >= [xi] Then
[oq] = 1
Else
p = p + [dq]
[qq] = 0
End If
End If
Next q
Next i
End Sub
[cq]
is a cell that contains date
[ui]
is a cell that contains number
[xi]
is a cell that contains date
cq
,ui
,xi
? – BruceWayne[aq] = [si]
is the equivalent ofcells(q, "A") = cells(i, "S")
? – user4039065