Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 70
Default PC User Name and date in cells

Hi,

When the user opens the file for the first time - I need Excel to input the
User name of the PC in A1, and in B1 I need to put todays date. When I open
the file tomorrow I still need it to show "yesterdays" date - so is there
away I can keep it static?

Thanks in advance,

AW
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,346
Default PC User Name and date in cells

You will need a VBA macro here is a quick sample:

Here is some sample code for the Workbook_Open procedu

Private Sub Workbook_Open()
myInfo = InputBox("Enter your ID")
If myInfo < "" Then
'your code
End If
End Sub

This code goes into the thisWorkbook object in the VBE. Press Alt+F11,
double-click the thisWorkbook object, for your workbook, in the Project
explorer near the top left of the screen.


--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"ArcticWolf" wrote:

Hi,

When the user opens the file for the first time - I need Excel to input the
User name of the PC in A1, and in B1 I need to put todays date. When I open
the file tomorrow I still need it to show "yesterdays" date - so is there
away I can keep it static?

Thanks in advance,

AW

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 269
Default PC User Name and date in cells

As an alternate to an InputBox you could use Application.UserName, but you
need to make sure that the individuals have entered thier user name in the
Excel
Tools:Options:General area.

Private Sub Workbook_Open()
If Sheets("SheetName").range("A1") = Empty then
Sheets("SheetName").range=("A1")=Application.UserN ame
Sheets("SheetName").range=("B1")=Date
End if

End Sub


"Shane Devenshire" wrote:

You will need a VBA macro here is a quick sample:

Here is some sample code for the Workbook_Open procedu

Private Sub Workbook_Open()
myInfo = InputBox("Enter your ID")
If myInfo < "" Then
'your code
End If
End Sub

This code goes into the thisWorkbook object in the VBE. Press Alt+F11,
double-click the thisWorkbook object, for your workbook, in the Project
explorer near the top left of the screen.


--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"ArcticWolf" wrote:

Hi,

When the user opens the file for the first time - I need Excel to input the
User name of the PC in A1, and in B1 I need to put todays date. When I open
the file tomorrow I still need it to show "yesterdays" date - so is there
away I can keep it static?

Thanks in advance,

AW

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default PC User Name and date in cells

You may want to get the user's login name rather than Application username,
which could be anything or nothing.

Environ("UserName")


Gord Dibben MS Excel MVP

On Thu, 29 Jan 2009 10:16:01 -0800, Paul C
wrote:

As an alternate to an InputBox you could use Application.UserName, but you
need to make sure that the individuals have entered thier user name in the
Excel
Tools:Options:General area.

Private Sub Workbook_Open()
If Sheets("SheetName").range("A1") = Empty then
Sheets("SheetName").range=("A1")=Application.UserN ame
Sheets("SheetName").range=("B1")=Date
End if

End Sub


"Shane Devenshire" wrote:

You will need a VBA macro here is a quick sample:

Here is some sample code for the Workbook_Open procedu

Private Sub Workbook_Open()
myInfo = InputBox("Enter your ID")
If myInfo < "" Then
'your code
End If
End Sub

This code goes into the thisWorkbook object in the VBE. Press Alt+F11,
double-click the thisWorkbook object, for your workbook, in the Project
explorer near the top left of the screen.


--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"ArcticWolf" wrote:

Hi,

When the user opens the file for the first time - I need Excel to input the
User name of the PC in A1, and in B1 I need to put todays date. When I open
the file tomorrow I still need it to show "yesterdays" date - so is there
away I can keep it static?

Thanks in advance,

AW


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
User name , date and time Rod Excel Discussion (Misc queries) 2 December 26th 07 01:03 AM
Dates - Need to display date one month prior to user-entered date brettopp Excel Worksheet Functions 13 December 3rd 07 05:58 PM
Current date in the comment instead of the user ID Gary[_2_] Excel Worksheet Functions 1 October 22nd 07 11:11 PM
incrementing a date that the user has entered? pano Excel Worksheet Functions 4 January 23rd 07 03:22 AM
user defined date [email protected] Excel Worksheet Functions 1 January 21st 05 08:57 PM


All times are GMT +1. The time now is 03:53 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"