dean_mcwhorter
New Member
- Joined
- Dec 12, 2009
- Messages
- 11
Is there away to count cells with 1 or more different fill colors in a column?
Thanks, Dean
Thanks, Dean
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Excel.Range, Cancel As Boolean)
With Target
If .Column = 1 Then
Cancel = True
If .Value <> "Out of Spec" Then
.Value = "Out of Spec"
Else
.Value = vbNullString
End If
End If
End With
End Sub
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Excel.Range, Cancel As Boolean)
Rem double click on a cell that has explicit list validation (a,b,c not A1:A10) and cylcle through
Rem the list, including blank.
Dim actionRange As Range
Dim listStrings As Variant
Dim IndexInList As Long, countOfList As Long
Set actionRange = Target.Parent.Range("A:A"): Rem adjust
With Target
If Not Application.Intersect(Target, actionRange) Is Nothing Then
On Error Resume Next
If TypeName(.Validation.Type) <> "Long" Then
On Error GoTo 0
Rem no validation = do nothing
Else
On Error GoTo 0
With .Validation
If .Type = 3 And Not (.Formula1 Like "=*") Then
Rem if explicit list style validation then
Cancel = True
Rem get list of validation values
listStrings = Split(.Formula1, ",")
countOfList = UBound(listStrings) + 2
Rem add vbNullString to the list
ReDim Preserve listStrings(0 To UBound(listStrings) + 1)
listStrings(UBound(listStrings)) = vbNullString
Rem advance one in the list
On Error Resume Next
IndexInList = (Application.Match(Target.Value, listStrings, 0) Mod countOfList)
On Error GoTo 0
Application.EnableEvents = False
Target.Value = listStrings(IndexInList)
Application.EnableEvents = True
End If
End With
End If
End If
End With
End Sub