Captain_Conman
Board Regular
- Joined
- Jun 14, 2018
- Messages
- 54
Hello!
I am very new with VBA and am currently working on writing a macro that deletes all the rows in a sheet, that hold a date that falls on or before 6/1/18. Here is what I have so far...
Sub Macro2()
With ActiveSheet
.AutoFilterMode = False
With Range("g1", Range("g" & Rows.Count).End(xlUp))
.AutoFilter 1, "<=6/1/18"
On Error Resume Next
.Offset(1).SpecialCells(12).EntireRow.Delete
End With
.AutoFilterMode = False
End With
End Sub
Everything works great, however, instead of typing the date into the code, I would like the macro to reference the date in the last row of column "G" on a sheet titled "Current". Any tips on how to make this reference would be appreciated! Thank you.
I am very new with VBA and am currently working on writing a macro that deletes all the rows in a sheet, that hold a date that falls on or before 6/1/18. Here is what I have so far...
Sub Macro2()
With ActiveSheet
.AutoFilterMode = False
With Range("g1", Range("g" & Rows.Count).End(xlUp))
.AutoFilter 1, "<=6/1/18"
On Error Resume Next
.Offset(1).SpecialCells(12).EntireRow.Delete
End With
.AutoFilterMode = False
End With
End Sub
Everything works great, however, instead of typing the date into the code, I would like the macro to reference the date in the last row of column "G" on a sheet titled "Current". Any tips on how to make this reference would be appreciated! Thank you.