ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,225
- Office Version
- 2007
- Platform
- Windows
Hi,
Im using the code below.
I have highlighted two pieces of code.
Red is what the code is to ignor OR I will then see an error message & when i debug i see the code highlighted in Blue selected.
So in the code of what to ignore is next years date of which is 2022
So next year i will start to enter the year 2023 BUT will i remember where etc in the code i need to edit.
So as per title Is there such a thing as a wild card of which i can use so the code justs ignores it ?
Example **2022** or **2023** meaning whatever is between the ** ** is ignored
Thanks
Im using the code below.
I have highlighted two pieces of code.
Red is what the code is to ignor OR I will then see an error message & when i debug i see the code highlighted in Blue selected.
So in the code of what to ignore is next years date of which is 2022
So next year i will start to enter the year 2023 BUT will i remember where etc in the code i need to edit.
So as per title Is there such a thing as a wild card of which i can use so the code justs ignores it ?
Example **2022** or **2023** meaning whatever is between the ** ** is ignored
Thanks
Rich (BB code):
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
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
If Target.Value = "NEVER" Or Target.Value = "TBA" Or Target.Value = "2022" Then Exit Sub
Application.ScreenUpdating = False
myStartCol = "A"
myEndCol = "K"
myStartRow = 7
myLastRow = Cells(Rows.Count, myStartCol).End(xlUp).Row
Set myRange = Range(Cells(myStartRow, myStartCol), Cells(myLastRow, myEndCol))
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