+ Reply to Thread
Results 1 to 13 of 13

Excel 2007 : Macro uses the same number of cells when proper case

  1. #1
    Registered User
    Join Date
    04-15-2011
    Location
    Sofia
    MS-Off Ver
    Excel 2007
    Posts
    67

    Macro uses the same number of cells when proper case

    I am trying to make macro for proper case the text in column A but the problem is that the macro uses the same number of cells i used to record the macro. For example, if i record the macro with 10 cells that have text in column A after this if i put a different text in 40 cells in column A and run the macro it will proper case only the first 10 cells with text. How to fix this? I want to make macro that will proper case all the cells from column A no matter if every time there is a different number of cells with text.


    Thanks!
    Last edited by emil9216; 05-05-2011 at 03:06 PM.

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,445

    Re: Macro uses the same number of cells when proper case

    Hi,

    This

    Please Login or Register  to view this content.
    will select all the cells in column A that contain something that's been directly entered (not the result of a formula). Is that of any use?
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Registered User
    Join Date
    04-15-2011
    Location
    Sofia
    MS-Off Ver
    Excel 2007
    Posts
    67

    Re: Macro uses the same number of cells when proper case

    Is it possible to do this just with formulas because i am not very familiar with coding macros and i need to record and other operations after proper casing?

  4. #4
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Macro uses the same number of cells when proper case

    Try this
    Please Login or Register  to view this content.
    [EDIT]
    Missed your last post

    Try
    Please Login or Register  to view this content.
    If your column has numbers that must be kept as numbers not text, then
    Please Login or Register  to view this content.
    Last edited by Marcol; 05-05-2011 at 09:10 AM.
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  5. #5
    Registered User
    Join Date
    04-15-2011
    Location
    Sofia
    MS-Off Ver
    Excel 2007
    Posts
    67

    Re: Macro uses the same number of cells when proper case

    This macro is good, but i need to proper case only the first letters of the words. But after this i want to add other things like, insert dashes between the words, combine B and C column. I know how to do these two operations but how to add them to the proper case macro?




    This formula =UPPER(A2) doesn't make any change. It still uses the same number of cells.

  6. #6
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Macro uses the same number of cells when proper case

    You would do best to post a sample workbook showing your Sheet Layout With Before and After examples.

    It should clearly illustrate your problem and not contain any sensitive data.

  7. #7
    Registered User
    Join Date
    04-28-2011
    Location
    bangalore india
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Macro uses the same number of cells when proper case

    hai try this code

    Sub uppercase()
    Dim cell As Range
    For Each cell In Selection.Cells
    If cell.HasFormula = False Then
    cell = UCase(cell)
    End If
    Next
    End Sub

  8. #8
    Registered User
    Join Date
    04-15-2011
    Location
    Sofia
    MS-Off Ver
    Excel 2007
    Posts
    67

    Re: Macro uses the same number of cells when proper case

    This is a sample macro i have recorded with 10 names in column A. If i paste text in more than 10 cells it will proper case only the text in the first 10 cells.
    Attached Files Attached Files

  9. #9
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Macro uses the same number of cells when proper case

    Apologies for my earlier post, somehow I thought you wanted Uppercase

    I don't see why you want to do this with a macro. However
    Please Login or Register  to view this content.
    This will put the formula you ask for in Column B for each used row in Column A

    This will convert Column A to Proper Case
    Please Login or Register  to view this content.

    If you put this in B1 and drag it down you will get the same result as the first macro.
    Please Login or Register  to view this content.

    Hope this helps.

  10. #10
    Registered User
    Join Date
    04-15-2011
    Location
    Sofia
    MS-Off Ver
    Excel 2007
    Posts
    67

    Re: Macro uses the same number of cells when proper case

    Thanks, the first macro works great. I am trying to add the other functions to the proper case macro but i have the same problem. After proper casing I want to insert dashes between the words and then combine the B and C column but it works only for 10 cells. I have uploaded an example.
    Attached Files Attached Files

  11. #11
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Macro uses the same number of cells when proper case

    Try this
    Please Login or Register  to view this content.

    Hope this helps.
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    04-15-2011
    Location
    Sofia
    MS-Off Ver
    Excel 2007
    Posts
    67

    Re: Macro uses the same number of cells when proper case

    Thanks! The macro works great.

  13. #13
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Macro uses the same number of cells when proper case

    Happy to have helped

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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