View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
AMell AMell is offline
external usenet poster
 
Posts: 5
Default Auto Run a Macro

Hi, I'm hoping that someone will take a look at this for me....

I would like this macro to auto run whenever there is a change to the
contents of the cells within the given range. The range comprises the linked
cells from drop down boxes and are alphanumeric lables (if that makes a
difference)

The code which I have assembled from loads of posts on this site is:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$AA$11:$AA$16" Then
Call ConfirmSelection
End If
End Sub

Sub ConfirmSelection()
Dim Msg As String
Select Case Range("AB16").Value = "5.5" And _
Range("AB15").Value = 4 And Range("AB15").Value <= 7.1
Case True
Msg = "OK"
Case Else
Select Case Range("AB16").Value = "6.7" And _
Range("AB15").Value = 4 And Range("AB15").Value <= 8.8
Case True
Msg = "OK"
Case Else
Select Case Range("AB16").Value = "6.8" And _
Range("AB15").Value = 4 And Range("AB15").Value <= 10.6
Case True
Msg = "OK"
Case Else
Select Case Range("AB16").Value = "8" And _
Range("AB15").Value = 7.8 And Range("AB15").Value <= 14.3
Case True
Msg = "OK"
Case Else
Msg = "Not OK, Please Re-select"
End Select
End Select
End Select
End Select
MsgBox "Indoor/Outdoor Unit Selection " & "" & Msg
End Sub


When I activate the code manually it works perfectly, but I just can't get
it work automatically.

Really hoping that someone can help.

Thanks

Anne