Insert User Name in cell after entry into another cell

Livin404

Well-known Member
Joined
Jan 7, 2019
Messages
743
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Greetings, I have a VBA that will insert the User's name with a title. This title & user name needs to be insert into Column G after the previous adjecent cell has data. So if data is entered into Cell F5 then the title and user name will be entered into Cell G5. This is process repeats it's everytime another entry is made in Column F. I'm fairly certain the basic formula I have works (not sure about the last couple of line). I just need it to be activated once data is entered in the previous column on the same row.
Thank you , so much

VBA Code:
Sub Insert_Sir_Name()
Dim LastRow As Long
Dim wSurame As String, Title As String
Dim x As Variant
LastRow = ActiveSheet.Cells(Rows.Count, "G").End(xlUp).Row
wSurname = UCase(Split(wName, ",")(0))
For Each x In Array("Cpt ", "Cpl ", "Mr ", "Mrs ", "Esq ", "Ms")
If InStr(wName, x) > 0 Then
Title = UCase(x)
Exit For
End If
 End Sub
 
Instead of UCase, use StrConv:

EG:
VBA Code:
StrConv("WHITESIDE",vbProperCase)
... will return "Whiteside"
 
Upvote 0

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Instead of UCase, use StrConv:

EG:
VBA Code:
StrConv("WHITESIDE",vbProperCase)
... will return "Whiteside"
Thank you, I was looking to see if "propercase" had something similar to UCase or LCase to I can just simply swap up the new word. After trying to find something, I don't think it exists. Which leads to wonder how I can work that code because I have
Excel Formula:
 (Split(Application.UserName, ",")(0))
. I will continue to work on this. You've been very kind.
 
Upvote 0

Forum statistics

Threads
1,214,644
Messages
6,120,709
Members
448,983
Latest member
Joaquim_Baptista

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