Link to home
Start Free TrialLog in
Avatar of choy77
choy77Flag for Afghanistan

asked on

Prompt user for data input in Excel

All,

Hopefully this will be a quick fix.  I would like to add some messages to the attached document to enforce the user to input text in a certain field?  This document is quite basic and used for raising internal orders.

I have added some information in the spreadsheet as to what I want.  I basically want the document to prompt the user if a certain cell has had no data inputted in it.  And also add a drop down box with certain information to enforce the user to select a division.

Any help greatly appreciated.
example.xlsx
Avatar of Ardhendu Sarangi
Ardhendu Sarangi
Flag of United States of America image

this is quite simple.. you need to add a data validation list for the column cell and the following code -

Private Sub Worksheet_Change(ByVal Target As Range)
Dim cel As Range, targ As Range
Dim i As Integer
Set targ = [B:D]    'Watch these cells for changes
Set targ = Intersect(targ, Target)
If targ Is Nothing Then Exit Sub
 
Application.ScreenUpdating = False
'MsgBox (targ.Address)
n = Mid(targ.Address, 3, 4)
If targ <> "" And Range("I" & n) = "" Then
MsgBox ("Nominal Code cannot be empty. Please enter a valid value.")
End If
Application.ScreenUpdating = True
End Sub

Open in new window


see attached excel for a working example.

- Ardhendu
Avatar of choy77

ASKER

Hi,

I cant see the attached file for a working sample?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Ardhendu Sarangi
Ardhendu Sarangi
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
any luck?
Avatar of choy77

ASKER

Works perfect thanks :)