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

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
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,814
Messages
6,181,123
Members
453,021
Latest member
Justyna P

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