Specifiying a Range

S

SamuelT

Hi all,

I have the following piece of script that brings up a prompt when
someone fills in a particular cell (in this case G10):

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Range)
Select Case Sh.Name
Case "Programme"
Select Case Target.Address(0, 0)
Case "G10"
Range("G10").Activate
MsgBox "Now please fill in Component information"

End Select

End Select
End Sub

I want cells G5:G350 to behave in the same way, but when I change the
line:

Case "G10"

to

Case "G5:G350"

the script stops working. Can anyone suggest what I'm doing wrong and
how I might rectify this problem?

TIA,

SamuelT
 
B

Bob Phillips

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Range)
If Not Intersect(Targte, Range("G5:G350")) Is Nothing Then
If sh.Name = "Programme" Then
MsgBox "Now please fill in Component information"
End If
End If
End Sub


--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)
 
I

Ivan Raiminius

Hi Samuel,

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Range)
Select Case Sh.Name
Case "Programme"
if not intersect(target,range("G5:G350")) is nothing then
Range("G10").Activate
MsgBox "Now please fill in Component information"
end if


End Select
End Sub

Probably you need also change "Range("G10").Activate". Let me know the
rule what cell should be activated.

Regards,
Ivan
 

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