+ Reply to Thread
Results 1 to 10 of 10

Macro: Text to Columns

  1. #1
    Registered User
    Join Date
    06-06-2014
    Posts
    16

    Macro: Text to Columns

    I have created a macro that selects everything in a sheet starting on A4 downwards. I want to use Text to Columns, delimited (comma and space) to separate the data.

    When I do it manually, it does not change the date into a date format but keeps it as text (ex. 05/29/21). However, when I run the macro I created through the manual process, it changes it to a date format. I do not want it in the date format. I also do not want it to be in text format either

    How do I edit the VBA to prevent it from converting anything to a date format without converting it to text, but just keeping it as general?

    Cross-posted: https://www.mrexcel.com/board/thread...lumns.1172499/

    Please Login or Register  to view this content.
    Last edited by HDTV; 05-31-2021 at 12:29 PM.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Macro: Text to Columns

    I do not want it in the date format. I also do not want it to be in text format either
    so what DO you want it as?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    06-06-2014
    Posts
    16

    Re: Macro: Text to Columns

    I want it formatted as general. When I upload manually, it is already set to general so 05/29/21 is exactly that, not the numerical representation of that. I would set it to text, but on that same column are time values and if you set the whole column to text, those time values come out as text as well. If you look at the left side of the photo below, you can what I am talking about (this is what I want). On the right side of the photo is what happens when I use the macro that made making the exact same steps as I did manually (this is not what I want).

    Attachment 734686

  4. #4
    Registered User
    Join Date
    06-06-2014
    Posts
    16

    Re: Macro: Text to Columns

    Just want to bump this to see if I can get any help. I am really stuck on this and am at a complete loss.

    Thanks.

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Macro: Text to Columns

    Quote Originally Posted by HDTV View Post
    I want it formatted as general. When I upload manually, it is already set to general so 05/29/21 is exactly that...
    If that is how it is displaying under General formatting, then that is already text, not a date. A real date...05/29/21...set as General would appear as 44345
    also, we cant work with pics (yours didnt come through anyway), we need actual (clean) excel files to work with

  6. #6
    Registered User
    Join Date
    11-06-2013
    Location
    Croydon,England
    MS-Off Ver
    MS 365 Subscription
    Posts
    16

    Re: Macro: Text to Columns

    Sorry if I am highjacking your thread but I cannot seem to get my spreadsheet to load under normal question post and only way to see GOADVANCED button is on replies not on news message If any body can help my excel file attached showing problem many thanks and apologies if I am out of order still new to this forum regarding asking for help
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    06-06-2014
    Posts
    16

    Re: Macro: Text to Columns

    I think I found a workaround where I leave it as general and it auto-formats to date and time, which I can work with. What I need to do is figure out how to write a VBA code that formats date values (greater than 1) as dates and time values ( 0 > x > 1) as time.

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Macro: Text to Columns

    Quote Originally Posted by jbelliot View Post
    Sorry if I am highjacking your thread but I cannot seem to get my spreadsheet to load under normal question post and only way to see GOADVANCED button is on replies not on news message If any body can help my excel file attached showing problem many thanks and apologies if I am out of order still new to this forum regarding asking for help
    Yes you are.

    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Macro: Text to Columns

    Quote Originally Posted by HDTV View Post
    I think I found a workaround where I leave it as general and it auto-formats to date and time, which I can work with. What I need to do is figure out how to write a VBA code that formats date values (greater than 1) as dates and time values ( 0 > x > 1) as time.
    Why not just format everything as date/time? Then it wont matter which is which

  10. #10
    Registered User
    Join Date
    06-06-2014
    Posts
    16

    Re: Macro: Text to Columns

    Quote Originally Posted by FDibbins View Post
    Why not just format everything as date/time? Then it wont matter which is which
    This is basically what I did. Thank you

+ 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. Text to Columns Macro
    By Brenda07 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-19-2021, 07:11 AM
  2. macro text columns
    By max_max in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-27-2015, 03:55 AM
  3. MAcro to - copy, transpose, text to columns, remove column A, combine all columns in 1
    By galvinpaddy in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 02-07-2013, 08:48 AM
  4. Text to Columns, but macro
    By RoMarius1981 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-22-2012, 07:18 AM
  5. Text to columns macro...
    By GTX1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-12-2011, 02:33 PM
  6. Text to columns Macro
    By dextras in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-23-2009, 04:31 AM
  7. Macro for Text to Columns - convert to text or general
    By goofy11 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-15-2005, 11:06 PM

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