Results 1 to 11 of 11

Convert text to data and remove specific lines

Threaded View

  1. #1
    Forum Contributor
    Join Date
    08-21-2011
    Location
    Australia, Perth
    MS-Off Ver
    Excel 2010
    Posts
    159

    Convert text to data and remove specific lines

    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
    Last edited by SubwAy; 02-10-2017 at 06:13 AM. Reason: correct typo

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Remove duplicates and if space or text came then stop
    By Sekars in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-05-2016, 05:48 PM
  2. [SOLVED] Concatinate string of text and remove duplicates
    By msmayhugh in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-20-2015, 06:38 PM
  3. macro to conver text to date
    By cpramesh in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-15-2014, 05:00 AM
  4. [SOLVED] Select rows between Bold text to remove duplicates
    By CharlieRB in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-01-2013, 11:50 AM
  5. Replies: 1
    Last Post: 10-23-2012, 09:12 AM
  6. Export a field from text file to excel and remove duplicates
    By premkrishnan in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 11-08-2011, 05:51 AM
  7. remove duplicates based on partial text match
    By smelkin in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-16-2011, 09:45 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1