|
-
Jan 20th, 2011, 10:00 AM
#1
Thread Starter
New Member
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 54 I have 7 groups of info that reflect the color Code in cells D13 54. 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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|