+ Reply to Thread
Results 1 to 14 of 14

macro to format cell values

  1. #1
    Forum Contributor
    Join Date
    08-12-2012
    Location
    mysore
    MS-Off Ver
    Excel 2007
    Posts
    212

    macro to format cell values

    Hi,

    I have to clean data like as mentioned below on regular basis.I need macro to find and replace the values quickly.

    Employee Count
    1000-9999
    1000-9999
    1000-9999
    1000-9999
    1000-9999
    100 to 200
    100>200
    100+
    100,
    Over 1000
    I have to keep all the data after hyphen that is 9999
    I have to keep all the data after 'to' that is 200
    I have to keep all the data after '>' that is 200
    I have to keep the data after 'Over'
    and remove trailing + and commas all in one function.
    The macro should help me to clean these requirements.
    Thanks,
    Last edited by narendrabr; 01-15-2014 at 05:12 AM.

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Need help to get macro to format cell values

    Please Login or Register  to view this content.
    Made a couple assumptions about your data but I think it works for the examples given.
    Last edited by ragulduy; 01-14-2014 at 07:56 AM.

  3. #3
    Forum Contributor
    Join Date
    08-12-2012
    Location
    mysore
    MS-Off Ver
    Excel 2007
    Posts
    212

    macro to format cell values

    Please provide entire vba code not just the function.

    Thanks in advance
    Last edited by narendrabr; 01-15-2014 at 05:11 AM.

  4. #4
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Need help to get macro to format cell values

    Please Login or Register  to view this content.
    You can also use it as a worksheet function.

    Note - if you need a full working solution straight off the bat, then you need to include an idea of what your data looks like/what it is laid out like. I'm not going to be able to use telepathy to work out the full vba code you need to apply the function to your data.

  5. #5
    Forum Contributor
    Join Date
    08-12-2012
    Location
    mysore
    MS-Off Ver
    Excel 2007
    Posts
    212

    Re: Need help to get macro to format cell values

    Ok.Thanks.

    Can you modify this code to my criteria?

    mployee Count
    1000-9999
    1000-9999
    1000-9999
    1000-9999
    1000-9999
    100 to 200
    100>200
    100+
    100,
    Over 1000

    I have to keep all the data after hyphen that is 9999
    I have to keep all the data after 'to' that is 200
    I have to keep all the data after '>' that is 200
    I have to keep the data after 'Over'

    and remove trailing + and commas all in one function.
    The macro should help me to clean these requirements.

    Please Login or Register  to view this content.

    Thanks,

  6. #6
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Need help to get macro to format cell values

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    08-12-2012
    Location
    mysore
    MS-Off Ver
    Excel 2007
    Posts
    212

    Re: Need help to get macro to format cell values

    Can you help me to modify my above code?

    Thanks

  8. #8
    Forum Contributor
    Join Date
    08-12-2012
    Location
    mysore
    MS-Off Ver
    Excel 2007
    Posts
    212

    Re: Need help to get macro to format cell values

    Can you please modify this code?

    Please Login or Register  to view this content.
    Thanks

  9. #9
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Need help to get macro to format cell values

    Hi - I did, perhaps somebody else can you provide you a more suitable solution.

  10. #10
    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,956

    Re: Need help to get macro to format cell values

    narendrabr you have been given 3 suggested answer already, and have not once indicated why or how they did not work, all you do is keep posting the same info and request.

    To get the help you want, you will need to help those trying to help you. Also, please do not post duplicate threads, they will be closed.

    yudlugar has offered some VBA suggestions, here is a regular formula, based on your data, that you can add to a helper column and copy down...
    =IF(OR(ISNUMBER(FIND("to",A2,1)),ISNUMBER(FIND(">",A2,1))),RIGHT(A2,3),IF(OR(ISNUMBER(FIND("+",A2,1)),ISNUMBER(FIND(",",A2,1))),LEFT(A2,3),RIGHT(A2,4)))
    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

  11. #11
    Forum Contributor
    Join Date
    08-12-2012
    Location
    mysore
    MS-Off Ver
    Excel 2007
    Posts
    212

    Re: Need help to get macro to format cell values

    Hi,

    Can you please provide the macro instead of the formula?

    Thank!

  12. #12
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Need help to get macro to format cell values

    I find this thread humourous, especially
    Quote Originally Posted by narendrabr View Post
    Please provide entire vba code not just the function.

    @narendrabr, do you have any idea what you are doing? (this is a sincere question, not meant to be offensive)

    In this closed thread, I've also provided a solution which seems to cover what you described. But you replied with a 'can you please provide the code?'. The code is in the file, just look into the VB editor?
    多么想要告诉你 我好喜欢你

  13. #13
    Forum Contributor
    Join Date
    08-12-2012
    Location
    mysore
    MS-Off Ver
    Excel 2007
    Posts
    212

    Re: Need help to get macro to format cell values

    Hi,

    Sorry for that.I do not see any attached file in your reply.

    Thanks in advance!

  14. #14
    Forum Contributor
    Join Date
    08-12-2012
    Location
    mysore
    MS-Off Ver
    Excel 2007
    Posts
    212

    Re: Need help to get macro to format cell values

    Hi,

    The code does not have Sub and end sub.
    I am basically looking to modify my code posted in #8

    Thanks!

+ 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] Macro to match values and format cell colour in several sheets
    By lindafinlay in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-21-2013, 01:53 AM
  2. Macro to insert cell values in another sheet depending on value and format
    By adw223 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-27-2013, 03:57 PM
  3. [SOLVED] Need Macro to Format Cells based on corresponding cell values
    By feckoffcup in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 11-14-2012, 04:29 PM
  4. [SOLVED] Macro to loop through cell values in a column and format multiple cell values
    By Roop in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-07-2012, 05:39 PM
  5. Macro to change number format of cell values
    By Sean Anderson in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-11-2007, 12:24 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