Global replacement of Comment's User name in workbook

HubbaBuba

New Member
Joined
Oct 27, 2009
Messages
8
I've changed 'the user's name', but that is only prospective (going forward). Do I have to get into VBA, or what is recommended to change ALL user names. (The "replace" command doesn't do it either).

Any thoughts? Thanks!
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Try

Code:
Sub Cmts()
Dim cmt As Comment, ws As Worksheet, s As String
s = InputBox("Enter old username")
For Each ws In ThisWorkbook.Worksheets
    For Each cmt In ws.Comments
        With cmt.Parent
            .NoteText Text:=Replace(.NoteText, s, Application.UserName)
        End With
    Next cmt
Next ws
End Sub
 
Upvote 0
Peter (or anyone), When I run it it takes me to one cell and opens a box w/ old user name. (But thought it would auto-replace all.) When it opens a cell w/ old user name at top, and a box at the bottom, I type my username in. I hit <enter. and it only sends me back to the VBA module screen (?).

Any ideas what I did wrong/to change? Here's what I put into VBA module:
Sub Cmts()
Dim cmt As Comment, ws As Worksheet, s As String
s = InputBox("Edward")
For Each ws In ThisWorkbook.Worksheets
For Each cmt In ws.Comments
With cmt.Parent
.NoteText Text:=Replace(.NoteText, s, Application.UserName)
End With
Next cmt
Next ws
End Sub
 
Upvote 0
Try

Code:
Sub Cmts()
Dim cmt As Comment, ws As Worksheet, s As String
s = "Edward"
For Each ws In ThisWorkbook.Worksheets
    For Each cmt In ws.Comments
        With cmt.Parent
            .NoteText Text:=Replace(.NoteText, s, Application.UserName)
        End With
    Next cmt
Next ws
End Sub
 
Upvote 0
Thanks, but didn't work. Didn't remove old user name from comments. (Oddly, did however, make enter comment section bold font). Any other ideas appreciated.
Thanks much
 
Upvote 0
When I run the first code that I posted it doesn't "take me" anywhere. It asks for the username to replace then replaces that username with the current username in all comments in all worksheets in the workbook that the code is run from.
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,261
Members
452,901
Latest member
LisaGo

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