When I run the vba code below it gets hung up on
the line item - "lastrow = Sheets("Sheet1").Cells(rows.Count, 1).End(x1Up).Row"
here is my vba;
Sub datesexcelvba()
Dim mydate1 As Date
Dim mydate2 As Long
Dim datetoday1 As Date
Dim datetoday2 As Long
Dim x As Long
lastrow = Sheets("Sheet1").Cells(Rows.Count, 1).End(x1Up).Row
For x = 2 To lastrow
mydate1 = Cells(x, 6).Value
maydate2 = mydate1
Cells(x, 9).Value = mydate2
datetoday1 = Date
datetoday2 = datetoday1
Cells(x, 10).Value = datetoday2
If mydate2 - datetoday2 = 3 Then
Cells(x, 7) = "Yes"
Cells(x, 7).Interior.ColorIndex = 3
Cells(x, 7).Font.ColorIndex = 2
Cells(x, 7).Font.Bold = True
Cells(x, 8).Value = mydate2 - datetoday2
End If
Next
End Sub
Any help on getting this to work will be great, thanks
the line item - "lastrow = Sheets("Sheet1").Cells(rows.Count, 1).End(x1Up).Row"
here is my vba;
Sub datesexcelvba()
Dim mydate1 As Date
Dim mydate2 As Long
Dim datetoday1 As Date
Dim datetoday2 As Long
Dim x As Long
lastrow = Sheets("Sheet1").Cells(Rows.Count, 1).End(x1Up).Row
For x = 2 To lastrow
mydate1 = Cells(x, 6).Value
maydate2 = mydate1
Cells(x, 9).Value = mydate2
datetoday1 = Date
datetoday2 = datetoday1
Cells(x, 10).Value = datetoday2
If mydate2 - datetoday2 = 3 Then
Cells(x, 7) = "Yes"
Cells(x, 7).Interior.ColorIndex = 3
Cells(x, 7).Font.ColorIndex = 2
Cells(x, 7).Font.Bold = True
Cells(x, 8).Value = mydate2 - datetoday2
End If
Next
End Sub
Any help on getting this to work will be great, thanks