+ Reply to Thread
Results 1 to 6 of 6

Macro for creating letters to UPPER letters

Hybrid View

  1. #1
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,033

    Macro for creating letters to UPPER letters

    I have words in cell range (i.e. A1:A1000) and I want them to became upper letters.

    Excel forum to EXCEL FORUM

    Please macro wich I can assign to some button
    Last edited by zbor; 12-07-2009 at 04:44 AM.
    Never use Merged Cells in Excel

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Macro for creating letters to UPPER letters

    I would use Evaluate

    Public Sub ConvertUpper()
    With Range("A1:A1000")
        .Value = Evaluate("IF(ISTEXT(" & .Address & "),UPPER(" & .Address & "),REPT(" & .Address & ",1))")
    End With
    End Sub

  3. #3
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Macro for creating letters to UPPER letters

    hi zbor
    try.. something like
    For Each Cell In TextCells
    Cell.Value = UCase(Cell.Value)
    Next Cell
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Macro for creating letters to UPPER letters

    I should have added that if you wanted the range to be based on active selection then

    Public Sub ConvertUpper()
    Dim rngArea As Range
    For Each rngArea In Selection.Areas
        With rngArea
            .Value = Evaluate("IF(ISTEXT(" & .Address & "),UPPER(" & .Address & "),REPT(" & .Address & ",1))")
        End With
    Next rngArea
    End Sub
    (evaluate essentially allows up to update en masse without iteration - here the iteration is only per range area should you select multi non-contiguous ranges, all cells within that area are updated simultaneously)

  5. #5
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,033

    Re: Macro for creating letters to UPPER letters

    Working! Thx!

  6. #6
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,033

    Re: Macro for creating letters to UPPER letters

    Y, works too

    (and when I said few months ago that I will start learning macro soon... I lie )

+ 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