Change result to Upper Case

Livin404

Well-known Member
Joined
Jan 7, 2019
Messages
743
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Greetings, I had great help from Eric last night, now I just need one small thing. I'm trying to figure out how I can change the end result to be in all capital letters. Basically after the formula I need the ranks found in the array to be in all CAPS.
Thank you

S
VBA Code:
ub find_last_plus_3()
Dim LastRow As Long, WorkName As String, Title As String, x As Variant

    LastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
    WorkName = Replace(Application.UserName, "GS-05", "Mr")
    Title = ""
    For Each x In Array("MR ", "Maj ", "Cpt ", "Col ")
        If InStr(WorkName, x) > 0 Then
            Title = x
            Exit For
        End If
    Next x
    Range("A" & LastRow + 3).Value = "UPDATED BY: " & Title & Split(WorkName, ",")(0)
End Sub
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
You just need to put UCase(<string_variable>) where needed

Example UCase("Good Morning") will give you GOOD MORNING
 
Upvote 0
You just need to put UCase(<string_variable>) where needed

Example UCase("Good Morning") will give you GOOD MORNING
I had tried it always I place it right at the bottom before End Sub and nothing happened. Thank you,

VBA Code:
Sub find_last_plus_3()
Dim LastRow As Long, WorkName As String, Title As String, x As Variant

    LastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
    WorkName = Replace(Application.UserName, "GS-05", "Mr")
    Title = ""
    For Each x In Array("MR ", "Maj ", "Cpt ", "Col ")
        If InStr(WorkName, x) > 0 Then
            Title = x
            Exit For
        End If
    Next x
    Range("A" & LastRow + 3).Value = "UPDATED BY: " & Title & Split(WorkName, ",")(0)
UCase ("*UPDATED BY: ")
End Sub
 
Upvote 0
If you want to UCase everything in range Range("A" & LastRow + 3), then just

UCase (Range("A" & LastRow + 3))

Check if this works
 
Upvote 0
If you want to UCase everything in range Range("A" & LastRow + 3), then just

UCase (Range("A" & LastRow + 3))

Check if this works
I did try it right in the line before End Sub, and I'm afraid nothing happened. I didn't get any errors but nothing changed. I end up with UPDATED BY: Capt WHITESIDE, where the result should be UPDATED BY: CAPT WHISTESIDE. Remember the names and ranks will change depending on the "username". Thank you
 
Upvote 0
Try:
VBA Code:
Range("A" & LastRow + 3).Value = "UPDATED BY: " & UCase(Title) & UCase(Split(WorkName, ",")(0))
 
Upvote 0
Solution
So the Title needs to be upper case. Try

Range("A" & LastRow + 3).Value = "UPDATED BY: " & UCase(Title) & Split(WorkName, ",")(0)

I did not fully understand I guess when you said Remember the names and ranks will change depending on the "username"

When is title need not to be upper case?

@Akuini code should work. I did not change the name to upper case here
 
Upvote 0
You're welcome, glad to help & thanks for the feedback. :)
 
Upvote 0
I was wondering why you did not just put everything in CAPS like

For Each x In Array("MR ", "MAJ ", "CPT ", "COL ")

then no need to use UCase ;)
 
Upvote 0

Forum statistics

Threads
1,215,085
Messages
6,123,030
Members
449,092
Latest member
ikke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top