I'm making a form with three buttons on it and a small spreadsheet of data. Each button is going to correspond with a different range of acceptable results. When you push the first button, I want it to highlight the results in the sheet as green if they are between 38 and 44.4, and highlight results out of that range in red. For the second button, I'd like the good range to be 33 to 39.4, and the third button to be 33 to 39.4 (same acceptable results range, different type of test). Basically I need different conditional formatting to be enacted with each button. I'm currently using:
Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Range("C16") > 44.4 Then Target.Interior.Color = vbRed
If Target.Range("C16") < 38 Then Target.Interior.Color = vbRed
If Target.Range("C16") >= 38 And Target <= 44.4 Then Target.Interior.Color = vbGreen
End Sub
I'm not familiar with the selection change property, and this doesn't work anyway. Not sure where to go from here. Any help would be appreciated. Thanks!