Excel VBA Target Intersect
Hello All,
This is my first posting here so I hope to get some great help.
I have a worksheet called X-Y-G Algorithm. On that worksheet I have 4 Color Codes. They are:
1 Green
2 Yellow
3 Red
4 Gray
In columns D13:D54 I have 7 groups of info that reflect the color Code in cells D13:D54. On another worksheet titled Cluster View I have some command buttons embedded on the worksheets labeled Button1 - Button 7
When a user clicks on Button1, I want it to check the values in cells G13:G16 on the R-Y-G Algorithm worksheet for that Group. For Button1 the group range to check against would be D13, D20, D27, D34, D41 and D48.
When a user Clicks on Button 2 it would check against D14, D21, D28, D35, D42, D49.
The other buttons would be increment descending.
When the user clicks the button I want it to display the corresponding code. If there is a 1 for GReen in one of the groups and then a 2 for Red, I want it to display Red for the worst case scenario.
I found some code on your site while searching:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim CheckRange As Range
Dim aCell As Range
Set CheckRange = Intersect(Target, Range("C5:C31"))
If Not CheckRange Is Nothing Then
For Each aCell In CheckRange
If aCell.Value = "Sent" Then
MsgBox ("Input Time")
Exit For
End If
Next
End If
End Sub
from this link: http://www.vbforums.com/showthread.php?t=604798
I think something similar may be done in my example using Interset and Target.
Any help will be greatly appreciated!
Thanks for reading my post!
Kurt
Re: Excel VBA Target Intersect
target is specific to the worksheet change event, your button event has no target
intersect just finds overlapping cells from 2 ranges, i doubt this helps for what you want to do
other than that i have no idea what you are trying to do