Hi all,
I've managed to come up with two macros which I feel are extremely close to working but somehow are still glitchy, and I was hoping you'd be able to help me
There are both on the same sheet to help me remove duplicates.
First one: converting a text field into a date. The current format (which I cannot change as it is an extract of Oracle) is, for example, 11-JAN-17. When using the macro below, I get the right conversion for 11-Jan but the year turns to 2011.
With ActiveSheet.UsedRange.Columns("A").Cells
.TextToColumns Destination:=.Cells(1), DataType:=xlFixedWidth, FieldInfo:=Array(0, xlYMDFormat)
.NumberFormat = "dd/mm/yyyy"
End With
Second one: I am trying to remove all lines for which my formula in column AF (of a Table, ie an actual table created by Excel with auto formatting, ranges, etc) returns TRUE. When using the macro, I lose all lines!
Sub Delete_Lines()
Dim ar As Variant
Dim ws As Worksheet
ar = Array("TRUE")
Sheets("Raw Data").Select
Application.ScreenUpdating = False
For Each ws In Worksheets
If ws.Name = "Raw Data" Then
ws.Range("AF1", ws.Range("B" & ws.Rows.Count).End(xlUp)).AutoFilter 1, ar, xlFilterValues
If ws.Range("AF" & Rows.Count).End(xlUp).Row > 1 Then
ws.Range("AF2", ws.Range("AF" & ws.Rows.Count).End(xlUp)).EntireRow.Delete
End If
ws.[AF1].AutoFilter
End If
Next ws
End Sub
Thanks in advance to anyone who can help.
IM
Bookmarks