Target Cell Problem

W

Wayne

Using Excel 97

I'm trying to get a message box to appear when cell F5 of
page "Labour Details" is selected. Then if ybYes is
selected "Hire Calculation" page is shown and if vbno the
message box dissapears....

This is the chunk of code that I'm trying to get to
work... As you can guess it doesn't!!!!

Can anyone help????

Thanks

Wayne


Private Sub worksheet_selectionChange(ByVal Target As
Excel.Range)
If Sheets("Labour Details").Target.Address = "$f$5"
Then
If ActiveCell.HasFormula Then
MsgBox ("Change Value via Hire calculation
Page")
MsgBox = MsgBox & MsgBox(vbLf)
MsgBox = MsgBox & ("Go to Hire Calculation
Page?")
Title = "Protected Cell"
COnfig = vbYesNo
Ans = MsgBox(Msg, COnfig, Title)
If Ans = vbNo Then End
Else If Ans = vbYes Then
Sheets("Hire Calculation").Select
End If
End If
End If
End Sub
 
D

Don Lloyd

Hi,
The following, placed in the Worksheet module of "Labour Details", would do
the main part of your requirement.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Res
If Target.Address <> "$B$5" Then Exit Sub
Res = MsgBox("Change Value Hire calculation Page ?", vbYesNo, "")
If Res = vbNo Then Exit Sub
Sheets("Hire Calculation").Select
End Sub

I think you have a small problem with syntax of the MsgBox.
Your reference to "$B$5" also looks a little unusual.

regards,
Don
 

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