Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default exit cell automatically after entering data

I want to require the user to enter his/her name in a specific cell (E59)
before the user can save the file.
I tried using Data Validation where I specified Text Length between 1 and
40, and left blank the check-box for "Ignore Blank". Nope. I never
programmed in VBA, so I hope there is a simple solution (I might be OK with
some simple VBA code).
---Pat
P.S. I posted this yesterday (Mar 19 2008) and someone was kind enough to
respond, but Microsoft's link (in the auto-generated e-mail to me) to the
response did not work. I thank that individual for responding, and ask that
you please re-send your answer.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default exit cell automatically after entering data

Put this in your ThisWorkbook code module. To access the VBA editor, press
Alt + F11. On the left you will see the Project window with sheet1, sheet2,
etc. and ThisWorkbook listed. Double click ThisWorkbook then copy and paste
this code into the big window.

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
RETRY:
userName = InputBox("Enter your first and last name.", "USER NAME")
If userName = False Or UserName = "" Then
MsgBox "You must enter your name to close this file."
GoTo RETRY:
End If
Range("E59") = userName
End Sub

When the user attempts to close the workbook, this code will run and will
not let them close until they enter something in the input box. Of course,
they can always use someone else's name.

"Patrick Riley" wrote:

I want to require the user to enter his/her name in a specific cell (E59)
before the user can save the file.
I tried using Data Validation where I specified Text Length between 1 and
40, and left blank the check-box for "Ignore Blank". Nope. I never
programmed in VBA, so I hope there is a simple solution (I might be OK with
some simple VBA code).
---Pat
P.S. I posted this yesterday (Mar 19 2008) and someone was kind enough to
respond, but Microsoft's link (in the auto-generated e-mail to me) to the
response did not work. I thank that individual for responding, and ask that
you please re-send your answer.

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
Automatically entering data Beverly Excel Discussion (Misc queries) 2 December 16th 08 07:49 AM
exit cell automatically after entering data Patrick Riley Excel Worksheet Functions 0 March 20th 08 03:23 PM
Move to next unprotected cell automatically after entering data Patrick Riley Excel Discussion (Misc queries) 2 April 2nd 07 10:17 PM
automatically date a cell when entering data in adjoining cell John Imm Excel Programming 1 October 9th 06 02:53 PM
Automatically entering data in cells dipdog[_2_] Excel Programming 0 August 16th 06 05:27 PM


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