+ Reply to Thread
Results 1 to 5 of 5

Data Cleaner Macro: Dates, Zeros, and TRIM

  1. #1
    Registered User
    Join Date
    02-20-2013
    Location
    Oregon
    MS-Off Ver
    Excel 2010
    Posts
    18

    Data Cleaner Macro: Dates, Zeros, and TRIM

    Hello Excel Masters

    I need some help with a data cleaning macro that will eliminate default dates "1/0/1900" and cells that contain only a zero "0". I also want to utilize the TRIM function to eliminate extra spaces.

    I humbly submit my neophyte code in the hopes someone can help. When I run this macro I receive the error "Run-time error '13': Type mismatch". When I press the Debug button, the yellow highlighter goes to the line of code that reads: cell.value = Trim(cell.Value)

    Much Thanks for the Help!!!

    Please Login or Register  to view this content.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Data Cleaner Macro: Dates, Zeros, and TRIM

    Hello PolarX,

    Try this correction...
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    02-20-2013
    Location
    Oregon
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Data Cleaner Macro: Dates, Zeros, and TRIM

    Hi Leith, Thank you so much for the reply

    I gave it a shot, but it still me the same error and again highlights:

    Please Login or Register  to view this content.
    Could it be that I have caused some confusion with my code by declaring a range named 'cell'? It is 'cello' now because I was experimenting with possible solutions.

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Data Cleaner Macro: Dates, Zeros, and TRIM

    Hello PolarX,

    Defining Cell as a Range object in Excel is fine. However, you could not do in Word because in Word it is already defined. Try this out. It Trims the Text of the cell and not the value. It should work.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-20-2013
    Location
    Oregon
    MS-Off Ver
    Excel 2010
    Posts
    18

    Re: Data Cleaner Macro: Dates, Zeros, and TRIM

    Right On Leith, that did the trick

    I used '.Text' in other parts of the code and should have followed suit with that part of code. I know your addition of the IF statement played a huge part in getting things to work correctly as well.

    Thanks Again for the valuable help!!! "West Coast Love"

+ 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. Delete Trailing Spaces without Removing leading zeros WITHOUT TRIM
    By Zach51215 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-20-2013, 04:24 PM
  2. [SOLVED] cleaner code
    By scancool in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-14-2012, 04:07 PM
  3. Looking for a cleaner macro
    By CNE5x in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 05-11-2012, 12:09 PM
  4. Concatenate VBA Macro that excludes duplicates and zeros... 30+ cells of data
    By supernovanexus in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 01-20-2012, 01:23 AM
  5. [SOLVED] Macro to copy from one sheet to another and trim data
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-22-2005, 04:15 PM

Tags for this Thread

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