Inserting Environment Variables into Cells

T

Tevibear

Hi,

I can't seem to figure out the simple code to put environment variables
into the cells of my choice with the click of a command button.

This is about as far as I got:

Private Sub Inert_Variables_Click()
ActiveCell = Environ("windir")
End Sub

I don't really want to use the activeCell object if I don't have to. Is
there a simple way like telling it which individual cells I want to
insert the different variables into like:

Cell A3 = Environ("windir")
Cell B7 = Environ("winbootdir")
Cell D4 = Environ("userprofile")
etc...

I really don't know where else to ask for help on this. There has got to
be a really simple way to do this.

Please help.

Thanks,

Kevin Hunter
Fabrication Specialist
 
H

Helmut Weber

Hi Tevibear,

like this:

Sub test()
' cells(row, column)
ActiveSheet.Cells(1, 1).Value = Environ("Username")
End Sub

--

Helmut Weber

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top