+ Reply to Thread
Results 1 to 9 of 9

Capitalize all Letters in Column B..rows will Vary

Hybrid View

trevor2524 Capitalize all Letters in... 12-12-2013, 11:30 AM
martindwilson Re: Capitalize all Letters in... 12-12-2013, 11:36 AM
trevor2524 Re: Capitalize all Letters in... 12-12-2013, 11:44 AM
Mumps1 Re: Capitalize all Letters in... 12-12-2013, 11:40 AM
trevor2524 Re: Capitalize all Letters in... 12-12-2013, 12:16 PM
ragulduy Re: Capitalize all Letters in... 12-12-2013, 12:20 PM
trevor2524 Re: Capitalize all Letters in... 12-12-2013, 12:27 PM
Mumps1 Re: Capitalize all Letters in... 12-12-2013, 12:35 PM
martindwilson Re: Capitalize all Letters in... 12-12-2013, 12:30 PM
  1. #1
    Forum Contributor
    Join Date
    06-15-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    214

    Capitalize all Letters in Column B..rows will Vary

    Hello everybody,

    Does anybody know an easy macro that will make every letter in column B Upper case. But the only thing is the rows will vary each time i run the macro so it will need to run until the last row in the column is UpperCase. Thanks for your help.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Capitalize all Letters in Column B..rows will Vary

    Heres one from my colection of other peoples code! i think this came from mrexcel
    Sub UpperCase()
        
        Application.ScreenUpdating = False
    
        Dim cell As Range
        For Each cell In Range("$B$1:" & Range("$B$1").SpecialCells(xlLastCell).Address)
            If Len(cell) > 0 Then cell = UCase(cell)
        Next cell
        
        Application.ScreenUpdating = True
        
    End Sub
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Contributor
    Join Date
    06-15-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    214

    Re: Capitalize all Letters in Column B..rows will Vary

    This works martindwilson but is making Columns C and D upper case as well. Is there a way to make it just for column B. And Mumps1 this coding is part of a bigger macro. I import all the data so thats why I'm trying to find a way to have the macro convert Column B only to uppercase. I appreciate the help.

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,026

    Re: Capitalize all Letters in Column B..rows will Vary

    Hi Trevor. Place this macro in the worksheet code module (not a regular module). The text in column B will automatically be converted to uppercase as you enter the data in each cell in column b and then exit the cell. You don't have to run any macro. This will be done automatically. Does this work for you?
    Private Sub Worksheet_Change(ByVal Target As Range)
        Application.EnableEvents = False
        Dim bottomB As Long
        bottomB = Range("B" & Rows.count).End(xlUp).Row
        If Not Application.Intersect(Target, Range("B1:B" & bottomB)) Is Nothing Then
            Target(1).value = UCase(Target(1).value)
        End If
        Application.EnableEvents = True
    End Sub

  5. #5
    Forum Contributor
    Join Date
    06-15-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    214

    Re: Capitalize all Letters in Column B..rows will Vary

    Hi does anybody know how to fix that one problem regarding it upper-casing Columns C and D and not just Column B. Sorry for the continuous posts I'm in kind-of a time crunch.

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

    Re: Capitalize all Letters in Column B..rows will Vary

    Sub UpperCase()
        
        Application.ScreenUpdating = False
    
        Dim cell As Range
        For Each cell In Range("$B$1:B" & Range("$B$1").SpecialCells(xlLastCell).row)
            If Len(cell) > 0 Then cell = UCase(cell)
        Next cell
        
        Application.ScreenUpdating = True
        
    End Sub
    or using mumps version
    Sub UpperCase()
        
        Application.ScreenUpdating = False
    
        Dim cell As Range
        For Each cell In Range("$B$1:B" & Range("B" & rows.count).end(xlup).row)
            If Len(cell) > 0 Then cell = UCase(cell)
        Next cell
        
        Application.ScreenUpdating = True
        
    End Sub

  7. #7
    Forum Contributor
    Join Date
    06-15-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    214

    Re: Capitalize all Letters in Column B..rows will Vary

    Thank You!

  8. #8
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,026

    Re: Capitalize all Letters in Column B..rows will Vary

    Hi Trevor. Have you tried my suggestion? I tried it on a dummy sheet and it worked for me. The advantage to using a Worksheet_Change event is that you don't have to keep running the macro each time. The data is converted automatically after you enter it.

  9. #9
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Capitalize all Letters in Column B..rows will Vary

    Sub UpperCase()
        
        Application.ScreenUpdating = False
    
        Dim cell As Range
      
        For Each cell In Range("B1:B" & Range("B" & Rows.Count).End(xlUp).Row)
            If Len(cell) > 0 Then cell = UCase(cell)
        Next cell
        
        Application.ScreenUpdating = True
        
    End Sub

+ 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] VBA to create a chart when data can vary in column position and rows
    By MalibuLX3 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 08-21-2013, 11:21 AM
  2. Replies: 8
    Last Post: 02-18-2010, 05:14 AM
  3. [SOLVED] How can I format the cells to capitalize ALL letters in a word?
    By lgb542 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-05-2005, 02:05 PM
  4. omitting column letters and numbers of rows
    By linnie in forum Excel General
    Replies: 1
    Last Post: 09-15-2005, 09:05 PM
  5. Vary the column widths for different rows
    By Marty in forum Excel General
    Replies: 3
    Last Post: 01-04-2005, 08:06 PM

Tags for this Thread

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