ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,738
- Office Version
- 2007
- Platform
- Windows
Morning,
I am using the code supplied below.
Most often a date will be in the cell but for first customers there will be the word NEVER or TBA
My issue is that if i click in a cell that has NEVER or TBA i see the error message INVALID PROPERTY VALUE
I understand its doing this because its not a date but can the code be edited to ignore the word NEVER & TBA etc
When i then debug i see the line selected below in yellow.
I am using the code supplied below.
Most often a date will be in the cell but for first customers there will be the word NEVER or TBA
My issue is that if i click in a cell that has NEVER or TBA i see the error message INVALID PROPERTY VALUE
I understand its doing this because its not a date but can the code be edited to ignore the word NEVER & TBA etc
When i then debug i see the line selected below in yellow.
Rich (BB code):
Private Sub Worksheet_SelectionChange(ByVal Target As Range) ' THIS WILL COLOUR ACTIVE CELL & KEEP INTERIOR COLOUR ONCE LEFT HAS BEEN LEFT
Dim myStartCol As String
Dim myEndCol As String
Dim myStartRow As Long
Dim myLastRow As Long
Dim myRange As Range
If Target.Cells.Count > 1 Then Exit Sub
Application.ScreenUpdating = False
' *** Specify columns to apply this to ***
myStartCol = "A"
myEndCol = "K"
' *** Specify start row ***
myStartRow = 7
' Use first column to find the last row
myLastRow = Cells(Rows.Count, myStartCol).End(xlUp).Row
' Build range to apply this to
Set myRange = Range(Cells(myStartRow, myStartCol), Cells(myLastRow, myEndCol))
' Check to see if cell selected is outside of range
If Intersect(Target, myRange) Is Nothing Then Exit Sub
With Target
.Worksheet.Cells.FormatConditions.Delete
.FormatConditions.Add xlExpression, , True
.FormatConditions(1).Interior.Color = vbWhite
End With
With Sheet7.DTPicker1
.Height = 40
.Width = 40
If Not Intersect(Target, Range("G7:H40")) Is Nothing Then
.Visible = True
.Top = Target.Top
.Left = Target.Offset(0, 1).Left
.LinkedCell = Target.ADDRESS
Else
.Visible = False
End If
End With
End Sub