ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Display error msg when cells left blank (https://www.excelbanter.com/excel-programming/356642-display-error-msg-when-cells-left-blank.html)

Jas

Display error msg when cells left blank
 
I am creating a form that users have to input (straight on to the worksheet)
certain information into. There are certain bits of information that is
mandatory and if these are not filled in then I want an error message to
appear saying that they have to fill that box in before they proceed.

Can anyone help on how I can do this?

Thanks!
Jas

Crowbar via OfficeKB.com

Display error msg when cells left blank
 
Jas wrote:
I am creating a form that users have to input (straight on to the worksheet)
certain information into. There are certain bits of information that is
mandatory and if these are not filled in then I want an error message to
appear saying that they have to fill that box in before they proceed.

Can anyone help on how I can do this?

Thanks!
Jas


Hello

When the commandbutton is clicked that tranfers your data to your sheet you
need to test the textbox items that you want to be filled e.g.

commandbutton1_click()

If textbox1.value = "" then
msgbox "You need to fill in your name"
exit sub
end if

If the textbox contains data then it will be ignored, you may need to repeat
this process if you have more than one box



--
Message posted via
http://www.officekb.com

Crowbar via OfficeKB.com

Display error msg when cells left blank
 
Sorry ive misinterpreted your post, please ignore my answer

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200603/1

Tom Ogilvy

Display error msg when cells left blank
 
You will probably need to put code in an appropriate event. Chip Pearson has
an overview of the events at
http://www.cpearson.com/excel/events.htm

look them over and decide when you want to determine if the user has
complied.

--
Regards,
Tom Ogilvy


"Jas" wrote:

I am creating a form that users have to input (straight on to the worksheet)
certain information into. There are certain bits of information that is
mandatory and if these are not filled in then I want an error message to
appear saying that they have to fill that box in before they proceed.

Can anyone help on how I can do this?

Thanks!
Jas


Jas

Display error msg when cells left blank
 
It would be a worksheet change event but the code doesnt seem to work:

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)

If Range(C3).Value = "" Then
Application.EnableEvents = False
MsgBox "This is a mandatory field. Please enter you name."
End If
Application.EnableEvents = True
End sub

"Tom Ogilvy" wrote:

You will probably need to put code in an appropriate event. Chip Pearson has
an overview of the events at
http://www.cpearson.com/excel/events.htm

look them over and decide when you want to determine if the user has
complied.

--
Regards,
Tom Ogilvy


"Jas" wrote:

I am creating a form that users have to input (straight on to the worksheet)
certain information into. There are certain bits of information that is
mandatory and if these are not filled in then I want an error message to
appear saying that they have to fill that box in before they proceed.

Can anyone help on how I can do this?

Thanks!
Jas


DawnTreader

Display error msg when cells left blank
 
Hello

try using a validation on the cell

data-validation...

"Jas" wrote:

It would be a worksheet change event but the code doesnt seem to work:

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)

If Range(C3).Value = "" Then
Application.EnableEvents = False
MsgBox "This is a mandatory field. Please enter you name."
End If
Application.EnableEvents = True
End sub

"Tom Ogilvy" wrote:

You will probably need to put code in an appropriate event. Chip Pearson has
an overview of the events at
http://www.cpearson.com/excel/events.htm

look them over and decide when you want to determine if the user has
complied.

--
Regards,
Tom Ogilvy


"Jas" wrote:

I am creating a form that users have to input (straight on to the worksheet)
certain information into. There are certain bits of information that is
mandatory and if these are not filled in then I want an error message to
appear saying that they have to fill that box in before they proceed.

Can anyone help on how I can do this?

Thanks!
Jas



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com