Empty cell warning

J

JT

The macro below is more or less what I'm looking for except I don't want a range but I would like to list specific cells instead. Since I don't know how to write macros I'm hoping someone can modify this macro so I can simply edit it by adding the cell(s) in question, for example: b1, c7, g12 etc. So if someone presses tab, enter or arrow the message would appear.

thanks for any assistance



Option Explicit
Private Sub Worksheet_SelectionChange(ByVal target As Range)

Application.EnableEvents = False

If Not Intersect(target, Range("A:AC")) Is Nothing Then
If target.Offset(0, -1).Value = "" Then
MsgBox "Please enter a value before continuing."
target.Offset(0, -1).Select
End If
End If

Application.EnableEvents = True

End Sub
 
J

James Ravenswood

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal target As Range)


Application.EnableEvents = False


If Not Intersect(target, Range("B9,C10,D13,E17")) Is Nothing Then
If target.Offset(0, -1).Value = "" Then
MsgBox "Please enter a value before continuing."
target.Offset(0, -1).Select
End If
End If


Application.EnableEvents = True
End Sub

This is for a specific list of cells. So B9 cannot be Selected until
A9 is filled.
 
J

JT

This is close to what I'm looking for however in the example given we can't
enter data unless A9 is filled (or the column next to it) which isn't a
field that we use. There are certain fields that are unlocked and those are
the ones that we want to fill.

For example, we always start with I3 then to k3, then I4 then to k4, then we
would jump to B9 then to G9, it isn't straight down a column.
 
J

JT

I was able to resolve this issue by changing the -1 to 0, but now my
question is how do I have this message appear after someone has hit enter,
tab, or an errow key?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top