Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Text Validation
Is there a way to require a user to enter text into a field (text field)
after data is entered into another field. This isn't a form. Just a regular Excel worksheet. I thought I could use the text length validation criteria and uncheck the Ignore Blank option, but no luck. Is this functionality even possible? Thank you. Paul |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Text Validation
This works for one cell. I need to validate text for a range of cells.
Also, if I select OK from the MsgBox and don't enter the data and move on to another cell and enter data, the MsgBox is displayed again, but my active cell isn't where the data is required. Is there a way to validate data for a range as well as place the cursor back to the cell where the text is required? Thank you for your assistance. Paul "Charles Harmon" wrote: Paul, Have you tried a Worksheet_Change Event? You can set it to validate the range in question. This is something simple it goes in the sheet code you are working on. Private Sub Worksheet_Change(ByVal Target As Range) Dim rng As Range Set rng = Range("A1") If IsEmpty(rng) Then MsgBox "HI" End If End Sub Charles "Paul K." <Paul wrote in message ... Is there a way to require a user to enter text into a field (text field) after data is entered into another field. This isn't a form. Just a regular Excel worksheet. I thought I could use the text length validation criteria and uncheck the Ignore Blank option, but no luck. Is this functionality even possible? Thank you. Paul |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Text Validation
Paul,
Try this. Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _ Cancel As Boolean) Dim myarray As Variant Dim mycnt As Integer myarray = Array("A1", "B2", "C3")<<<<< You need to add the cells you want to check With Worksheets("sheet1") For mycnt = 1 To UBound(myarray) If .Range(myarray(mycnt)).Value = "" Then MsgBox "I'M Sorry missing information : " & myarray(mycnt) .Range(myarray(mycnt)).Select Exit Sub End If Next End With End Sub Put code in the workbook module. "Paul K." wrote in message ... This works for one cell. I need to validate text for a range of cells. Also, if I select OK from the MsgBox and don't enter the data and move on to another cell and enter data, the MsgBox is displayed again, but my active cell isn't where the data is required. Is there a way to validate data for a range as well as place the cursor back to the cell where the text is required? Thank you for your assistance. Paul "Charles Harmon" wrote: Paul, Have you tried a Worksheet_Change Event? You can set it to validate the range in question. This is something simple it goes in the sheet code you are working on. Private Sub Worksheet_Change(ByVal Target As Range) Dim rng As Range Set rng = Range("A1") If IsEmpty(rng) Then MsgBox "HI" End If End Sub Charles "Paul K." <Paul wrote in message ... Is there a way to require a user to enter text into a field (text field) after data is entered into another field. This isn't a form. Just a regular Excel worksheet. I thought I could use the text length validation criteria and uncheck the Ignore Blank option, but no luck. Is this functionality even possible? Thank you. Paul |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Data Validation for text only | Excel Discussion (Misc queries) | |||
Validation - Weekend Or text | Excel Worksheet Functions | |||
Validation (Drop down list vs simple text length validation) | Excel Programming | |||
Validation (Drop down list vs simple text length validation) | Excel Programming | |||
Validation (Drop down list vs simple text length validation) | Excel Programming |