Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Molly Brown   on Oct 02 In MS Office Category.

  
Question Answered By: Dep Tran   on Oct 02

I think I understand what you are wanting. It seems like a real pain
for a User that enters a value in column  W and then selects a new Row
with no intention of entering more data. Would it help too for your
code to verify other fields in the same row? If the whole row  is
empty then column W shouldn't matter, right?

Anyways, here is something I put together to fulfill what I think you
asked for.

Dim trg As Long

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If trg = 0 Then
trg = Target.Row
End If

'trg helps compare the new row selected with the previous row used
If (trg <> Target.Row And Cells(trg, 23) = "") Then
Cells(trg, 23).Select
MsgBox ("You must enter  a value in Column W")
Else
trg = Target.Row
End If

End Sub

Share: 

 

This Question has 3 more answer(s). View Complete Question Thread

 


Tagged: