track computer name

ttowncorp

Board Regular
Joined
Feb 2, 2015
Messages
187
Office Version
  1. 365
Platform
  1. Windows
is there a way in the code below to instead of it giving you the windows version but to give you the computer name instead for example the computer name is pc-1101and using another computer the name pc-1102

Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range
If Not Intersect(Target, Me.Range("A:A, L:L")) Is Nothing Then
For Each cell In Intersect(Target, Me.Range("A:A, L:L"))
If cell.Value <> "" Then
Me.Cells(cell.Row, "S").Value = Now()
Me.Cells(cell.Row, "T").Value = Application.UserName
Me.Cells(cell.Row, "U").Value = Application.OperatingSystem 👈

Else
Me.Cells(cell.Row, "S").ClearContents
Me.Cells(cell.Row, "T").ClearContents
Me.Cells(cell.Row, "U ").ClearContents

End If
Next cell
End If
End Sub
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
How about
VBA Code:
Me.Cells(cell.Row, "U").Value = Environ("computername")
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0
thank you for this.:biggrin:

The marked solution has been changed accordingly. In your future questions, please mark the post as the solution that actually answered your question, instead of your feedback message as it will help future readers. No further action is required for this thread.
 
Upvote 0

Forum statistics

Threads
1,224,271
Messages
6,177,620
Members
452,786
Latest member
k3calloway

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