Get Computer Name using Excel VBA

Did you know that using Excel VBA you can get the computer name and print it to a cell.

I have used this before to monitor which computers on a network where accessing a staff performance system. I won’t publish the full code, but just the section that gets the computer name.

So, the code below would be entered as a new module. Note, it is just one line of code to get the name and print to the cell.

Public Sub Get_Computer_Name()

Cells(1,1) = Environ("computername")

End Sub

You could add in an extra line of code to then get the username of the person logged into the computer. Of course, this works when the pc requires a user to log in!

2,519 thoughts on “Get Computer Name using Excel VBA

  1. HP driver

    When I initially left a comment I seem to have clicked on the -Notify me when new comments are added- checkbox and from now on every time a comment is added I receive four emails with the exact same comment. There has to be an easy method you can remove me from that service? Cheers!

  2. https://genolyze.com/

    The next time I read a blog, I hope that it doesn’t disappoint me just as much as this particular one. After all, Yes, it was my choice to read, nonetheless I genuinely believed you would probably have something interesting to say. All I hear is a bunch of moaning about something you could fix if you weren’t too busy seeking attention.

  3. toko online 88

    An impressive share! I have just forwarded this onto a coworker who was conducting a little homework on this. And he in fact bought me breakfast due to the fact that I stumbled upon it for him… lol. So allow me to reword this…. Thanks for the meal!! But yeah, thanks for spending the time to discuss this issue here on your blog.

  4. agen slot vivoslot

    Oh my goodness! Awesome article dude! Thank you, However I am experiencing problems with your RSS. I don’t understand why I cannot join it. Is there anybody else having similar RSS problems? Anyone that knows the answer can you kindly respond? Thanks!!

  5. apk vivoslot

    I wanted to thank you for this wonderful read!! I absolutely enjoyed every bit of it. I’ve got you saved as a favorite to look at new stuff you post…

  6. website,

    Its such as you read my mind! You seem to grasp a lot approximately this, like you wrote the
    book in it or something. I feel that you just could do with a few
    % to drive the message house a little bit, however instead of that, that is great blog.
    A fantastic read. I’ll certainly be back.

  7. 谷歌SEO

    hey there and thank you for your info – I have certainly picked
    up something new from right here. I did however expertise some technical issues using
    this web site, as I experienced to reload the web site many times previous to I could get it to load properly.
    I had been wondering if your web host is OK?
    Not that I’m complaining, but slow loading instances times will often affect your
    placement in google and can damage your high-quality score if advertising and marketing with Adwords.
    Anyway I am adding this RSS to my e-mail and can look out for a lot more of your respective fascinating content.
    Ensure that you update this again very soon.

  8. daftar vivo slot

    Having read this I thought it was really informative. I appreciate you finding the time and energy to put this information together. I once again find myself spending a significant amount of time both reading and commenting. But so what, it was still worthwhile!

  9. vivoslot net

    Nice post. I learn something totally new and challenging on websites I stumbleupon every day. It’s always exciting to read articles from other authors and practice a little something from other websites.

  10. slot online

    Your style is unique in comparison to other folks I have read stuff from. Thank you for posting when you’ve got the opportunity, Guess I’ll just book mark this web site.

Comments are closed.