Hello, I have the following code that when used without the date part works just great, HOWEVER with the date it appears to just go into a loop and the screen justs flashes as the ranges are repainted.
Can someone see a problem with the date? or anything else perhaps?
Thank You
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A1:I29")) Is Nothing Then Exit Sub ' not wanted
Dim myString As Range
Set myString = Range("A1")
Range("A1") = ThisWorkbook.Name
myString = Left(myString, Len(myString) - 4) 'Change number depending on saved version either 2003 or 2007
Range("B13") = Range("A1") + 1
' 1) The Following Code changes ALL Border line colors to white (color Themecolor 1)
Range("A3:I29").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders
.LineStyle = xlContinuous
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 2
End With
'3)The Following Frames each required range.
Range("A4:A7,B4:B7,D4:D7,E4:E7,G4:G7,H4:H7,A8:A11,B8:B11,G8:G11,H8:H11,D13:D16,E13:E16,G13:G16,H13:H16,D17:D20,E17:E20,G17:G20,H17:H20,A22:A25,B22:B25,G22:H29,A26:A29,B26:B29").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.Weight = xlThin
End With
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
'4) Within the following range, color background "Yellow"
Range("A1").Select
End Sub
Can someone see a problem with the date? or anything else perhaps?
Thank You
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A1:I29")) Is Nothing Then Exit Sub ' not wanted
Dim myString As Range
Set myString = Range("A1")
Range("A1") = ThisWorkbook.Name
myString = Left(myString, Len(myString) - 4) 'Change number depending on saved version either 2003 or 2007
Range("B13") = Range("A1") + 1
' 1) The Following Code changes ALL Border line colors to white (color Themecolor 1)
Range("A3:I29").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders
.LineStyle = xlContinuous
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 2
End With
'3)The Following Frames each required range.
Range("A4:A7,B4:B7,D4:D7,E4:E7,G4:G7,H4:H7,A8:A11,B8:B11,G8:G11,H8:H11,D13:D16,E13:E16,G13:G16,H13:H16,D17:D20,E17:E20,G17:G20,H17:H20,A22:A25,B22:B25,G22:H29,A26:A29,B26:B29").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.Weight = xlThin
End With
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
'4) Within the following range, color background "Yellow"
Range("A1").Select
End Sub