excelnewb2020
New Member
- Joined
- Jan 13, 2021
- Messages
- 3
- Office Version
- 2016
- Platform
- Windows
I am having an issue writing a script that will loop through each cell and delete each row that contains a cell with a range of dates. For example, the below table should keep all of the rows that have a single date (i.e. 2021-01-12) while deleting all rows that contain a range (i.e. 2021-01-01 - 2021-01-02).
The script I have written so far does not work:
Sub test ()
Dim lastRow2 as Long
lastRow2 = Range("A" & Rows.Count).End(xlUp).Row
For Each c In Range("A2", "A" & lastRow2)
If Len(c) > 10 Then c.EntireRow.Delete
Next c
End sub
The script I have written so far does not work:
Sub test ()
Dim lastRow2 as Long
lastRow2 = Range("A" & Rows.Count).End(xlUp).Row
For Each c In Range("A2", "A" & lastRow2)
If Len(c) > 10 Then c.EntireRow.Delete
Next c
End sub
2021-01-12 | OtherData |
2021-01-12 | OtherData |
2021-01-12 | OtherData |
2021-01-12 | OtherData |
2021-01-12 | OtherData |
2021-01-12 | OtherData |
2021-01-12 | OtherData |
2021-01-01 - 2021-01-02 | OtherData |
2021-01-01 - 2021-01-02 | OtherData |
2021-01-01 - 2021-01-02 | OtherData |
2021-01-01 - 2021-01-02 | OtherData |
2021-01-01 - 2021-01-02 | OtherData |
2021-01-01 - 2021-01-02 | OtherData |
2021-01-01 - 2021-01-02 | OtherData |