Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Inserting Environment Variables into Cells

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 163
Default Inserting Environment Variables into Cells

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"
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Inserting Environment Variables into Cells

Thank you so much!!! You are the bomb! :)


Helmut Weber wrote:

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"

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
System Environment Variables bdickert Excel Discussion (Misc queries) 1 October 8th 06 08:40 PM
System Environment Variables bdickert Excel Discussion (Misc queries) 9 October 7th 06 09:34 PM
inserting variables in code???? westg Excel Programming 2 August 15th 05 01:00 PM
How do I use environment variables in Excel? kfloyd Excel Programming 3 December 1st 04 09:17 PM
Can I use Environment variables (such as %USERPROFILE%) in Excel . Tom Ogilvy Excel Programming 0 August 24th 04 04:42 PM


All times are GMT +1. The time now is 06:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"