Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Because I'm limited to worksheet events in the embedded environment her
is a reworked version that informs the user that they must fill in th first 3 cells of a row if they fill in any of the values. This i triggered when the user moves to a new row. Code ------------------- Private Sub Worksheet_SelectionChange(ByVal Target As Range) If PreviousRowRef = 0 Then PreviousRowRef = Target.Row End If RowRef = Target.Row ColumnRef = Target.Column If PreviousRowRef < Target.Row Then Set ws = Application.ActiveSheet WithData = 0 FirstColumn = 1 LastColumn = 3 'Number of columns to check For Each c In ws.Range(Cells(PreviousRowRef, FirstColumn), Cells(PreviousRowRef, LastColumn)) 'Check all mandatory fields for this row have been completed If c.Value < "" Then WithData = WithData + 1 End If Next c If WithData < LastColumn And WithData < 0 Then MsgBox "Please enter values in Row " + CStr(PreviousRowRef) + ", Cells " + CStr(FirstColumn) + " to " + CStr(LastColumn), vbOKOnly, "Fill in Mandatory cell value" End If End If PreviousRowRef = Target.Row End Sub ------------------- -- Message posted from http://www.ExcelForum.com |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
CLear Data Entry Form Fields | Excel Discussion (Misc queries) | |||
Data Form does not allow entry in some fields | Excel Discussion (Misc queries) | |||
Forcing an entry | Excel Discussion (Misc queries) | |||
Checking & Forcing Data Entry in Cells | Excel Discussion (Misc queries) | |||
Forcing Combo box entry in VBA | Excel Discussion (Misc queries) |