Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Make text cells and combo boxes required?

I would like to make some text cells and combo boxes required fields. Is
there a way to format these cells/combo boxes so that when there is no value
selected the user receives an error messaging upon saving letting them know
that they must complete the required fields before they can save the
spreadsheet?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,069
Default Make text cells and combo boxes required?

I think you will need VBA for this. You can add a Workbook_BeforeSave event
in the ThisWorkbook module. For example:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
'Check for a value in cell B5 on Sheet1.
If Len(Sheets("Sheet1").Range("B5").Value) = 0 Then
MsgBox "Cell B5 on Sheet1 must have data before saving"
'Setting Cancel to TRUE stops the workbook from saving.
Cancel = True
Exit Sub
End If
'Check for a selection in combo box Drop Down 1.
If Sheets("Sheet1").Shapes("Drop Down 1").ControlFormat.ListIndex = 0 Then
MsgBox "You must select a value from the combo box before saving"
Cancel = True
Exit Sub
End If
End Sub

Hope this helps,

Hutch

"mlroy@savvis" wrote:

I would like to make some text cells and combo boxes required fields. Is
there a way to format these cells/combo boxes so that when there is no value
selected the user receives an error messaging upon saving letting them know
that they must complete the required fields before they can save the
spreadsheet?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Make text cells and combo boxes required?

And hope that users do not disable macros when opening the workbook.

You need a whole 'nother set of code to deal with that.


Gord Dibben MS Excel MVP

On Mon, 24 Jul 2006 09:25:02 -0700, Tom Hutchins
wrote:

I think you will need VBA for this. You can add a Workbook_BeforeSave event
in the ThisWorkbook module. For example:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
'Check for a value in cell B5 on Sheet1.
If Len(Sheets("Sheet1").Range("B5").Value) = 0 Then
MsgBox "Cell B5 on Sheet1 must have data before saving"
'Setting Cancel to TRUE stops the workbook from saving.
Cancel = True
Exit Sub
End If
'Check for a selection in combo box Drop Down 1.
If Sheets("Sheet1").Shapes("Drop Down 1").ControlFormat.ListIndex = 0 Then
MsgBox "You must select a value from the combo box before saving"
Cancel = True
Exit Sub
End If
End Sub

Hope this helps,

Hutch

"mlroy@savvis" wrote:

I would like to make some text cells and combo boxes required fields. Is
there a way to format these cells/combo boxes so that when there is no value
selected the user receives an error messaging upon saving letting them know
that they must complete the required fields before they can save the
spreadsheet?


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
Combo boxes and formulas TC Excel Worksheet Functions 4 April 12th 06 11:22 PM
Shifting Combo boxes Steve C Excel Discussion (Misc queries) 2 March 2nd 06 06:52 PM
Hide my combo boxes! hays4 Excel Discussion (Misc queries) 6 November 7th 05 02:45 PM
Nesting Combo Boxes /Returning an Array ELMONDO SNITHER Excel Discussion (Misc queries) 1 June 30th 05 01:15 AM
dynamic combo boxes tjb Excel Worksheet Functions 2 January 25th 05 07:33 PM


All times are GMT +1. The time now is 12:21 AM.

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"