+ Reply to Thread
Results 1 to 8 of 8

VB Code to format data

  1. #1
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    VB Code to format data

    Hello:

    I need a VB Code to do the following:

    I have data in column L thru ED.
    I need code to format the data as follows.
    M101 : M900 to no digit (Integer number)
    Q101 : Q900 to no digit (Integer number)
    M101 : M900 to no digit (Integer number)
    Q101 : Q900 to no digit (Integer number);
    until column EC

    Then
    N101 : N900 to 2 digit
    Q101 : Q900 to 2 digit
    M101 : M900 to 2 digit
    Q101 : Q900 to 2 digit ;
    until column ED

    Please let me know if you have any questions.
    Thanks.

    Riz

  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,969

    Re: VB Code to format data

    If that is all you have, why not just do the formatting manually? It looks like each block has the same format, so just highlight the range and apply teh format - then repeat for the 2nd range?
    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
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB Code to format data

    Hello:

    I am coming across lots of files like this on daily basis and need an easy way since this will require to select lots of data.

    Thanks

    Riz

  4. #4
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,527

    Re: VB Code to format data

    Please confirm your ranges as they are repeated in your first block and some are overwritten in the second

    Also what format do you want i.e. "#,##0;(#,##0)" for no digits (decimals) etc? You could achieve a large part of what you're after via the recorder.
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  5. #5
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB Code to format data

    Hello;

    Oh I see your point.....it was my error about the data
    Please let me correct as below..

    I have data in column L thru ED.
    I need code to format the data as follows.
    M101 : M900 to no digit (Integer number) Example 123
    Q101 : Q900 to no digit (Integer number)
    U101 : U900 to no digit (Integer number)
    Y101 : Q900 to no digit (Integer number);
    until column EC

    Then
    N101 : N900 to 2 digit example 123.45
    R101 : R900 to 2 digit
    V101 : V900 to 2 digit
    Z101 : Z900 to 2 digit ;
    until column ED

    Basically every 4th column

    Once again i just realized my mistake and would appreciate your help.

    Thanks

    Riz

  6. #6
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,527

    Re: VB Code to format data

    Try this while on the sheet in question:

    Please Login or Register  to view this content.
    Robert

  7. #7
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB Code to format data

    Hi Robert:

    Thanks a lot, it works great for me.

    Riz

  8. #8
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,527

    Re: VB Code to format data

    Thanks for the feedback and marking the thread as solved (and for the rep)

+ 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. Need code to convert numbers in to data format
    By winmaxservices1 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-05-2015, 02:47 AM
  2. Need code to convert numbers in to data format
    By winmaxservices1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-04-2015, 09:58 AM
  3. [SOLVED] VBA code pull data from SQL db - need output dates in proper date format
    By seatejo in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-15-2014, 02:28 AM
  4. VBA Code or Formula to Convert format of extracted Data
    By Bpd in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-03-2014, 01:17 PM
  5. [SOLVED] Need to Sum data by Number Format Code
    By aussie_sox in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-23-2012, 09:26 AM
  6. adjusting code to accept data in row format
    By toadhall in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-16-2012, 05:22 PM
  7. VBA Code to copy the format from source data to extracted report
    By rav4u_tom in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-08-2010, 03:53 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