Avner,
You need to use the GetComputerName API call in a VBA function.
For example,
Declare Function GetComputerName Lib "kernel32" _
Alias "GetComputerNameA" ( _
ByVal lpBuffer As String, nSize As Long) As Long
Function ComputerName() As String
Dim L As Long
Dim R As Long
Dim S As String
S = String$(255, " ")
L = Len(S)
R = GetComputerName(S, L)
ComputerName = Left(S, L)
End Function
You can then call this from a worksheet cell with =COMPUTERNAME()
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com