View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
ShaneDevenshire ShaneDevenshire is offline
external usenet poster
 
Posts: 2,344
Default how a msg pop up if user enter data in col A but forgot data col B

Well, I like that one, I click Post and it dump my entire post!

Let's try again.

1. You can set up a formula in column C, suppose the first data cells are
A2:B2 then the formula would be:
=IF(AND(A2<"",B2=""),"Enter something in column
B.",IF(AND(A2="",B2<""),"Not acceptable",""))

2. You could run a vba routine that would read:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim theRow As Long
Set isect = Application.Intersect(Target, Range("A2:B20"))
If Not isect Is Nothing Then
theRow = Target.Row
If Cells(theRow, 1) < "" And Cells(theRow, 2) = "" Then
MsgBox "You must enter something in cell: B" & theRow
ElseIf Cells(theRow, 2) < "" And Cells(theRow, 1) = "" Then
MsgBox "No acceptable"
End If
End If
End Sub

3. You could set up conditional formats on column A and B:

Column A: =AND(A2="",B2<"")
Column B: =AND(B2="",A2<"")

These are set up by selecting one column or the other and choosing Format,
Conditional Formatting, picking Formula is from the first drop down and
entering one of the formulas above. Then click the Format button and on the
patterns tab pick a color and click OK twice. Repeat the same process on the
other column using the second formula above.

--
Cheers,
Shane Devenshire


"Celline" wrote:

column A column B
123 788

if column A = blank, b=blank
if column A= non blank, b=blank = error
A message shuould appear & remind the user to key in data in B
if column A=blank, b=non blank = not acceptable