+ Reply to Thread
Results 1 to 11 of 11

Convert text to data and remove specific lines

  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.

    Please Login or Register  to view this content.
    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!

    Please Login or Register  to view this content.
    Thanks in advance to anyone who can help.
    IM
    Last edited by SubwAy; 02-10-2017 at 06:13 AM. Reason: correct typo

  2. #2
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: Conver text to data and remove duplicates

    Please upload a sample workbook.
    Teach me Excel VBA

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

    Re: Convert text to data and remove specific lines

    Sorry about that, I just included one

    Thanks.
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: Convert text to data and remove specific lines

    Second macro is modified

    Please Login or Register  to view this content.
    Last edited by ImranBhatti; 02-10-2017 at 09:16 AM. Reason: Modification in code.

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

    Re: Convert text to data and remove specific lines

    This works perfectly, thank you

    I just need to figure out how to convert my dates!

  6. #6
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: Convert text to data and remove specific lines

    Please Login or Register  to view this content.
    There problem is not with the macro. Problem seems to be with your extracted data from Oracle.
    You need to refresh all the cells of B column before running this data macro.


    Then run this macro .
    Hopefully it will work

    Best Regards
    Imran Bhatti
    Last edited by ImranBhatti; 02-10-2017 at 12:40 PM.

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

    Re: Convert text to data and remove specific lines

    Hi Imran,

    How would you suggest I refresh all the cells in column B? Is this something I can build into the macro?

    Thanks,
    IM

  8. #8
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: Convert text to data and remove specific lines

    Quote Originally Posted by SubwAy View Post
    Hi Imran,

    How would you suggest I refresh all the cells in column B? Is this something I can build into the macro?

    Thanks,
    IM
    Try this instead

    Please Login or Register  to view this content.
    Last edited by ImranBhatti; 02-11-2017 at 11:38 AM.

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

    Re: Convert text to data and remove specific lines

    This is perfect, thank you

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

    Re: Convert text to data and remove specific lines

    ImranBhatti, can I ask why you use the XFD1 range in your macro and how it works in my case? I'm just curious to understand so I can replicate it again.

    Thanks,

  11. #11
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: Convert text to data and remove specific lines

    Simple
    In order to refresh your range of extracted data, I multiplied the column B with 1.and this 1 was taken from a cell that was far far away from your original data.This was done by using the PasteSpecial method (you might be familiar with).

+ Reply to Thread

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