Trevor3007
Well-known Member
- Joined
- Jan 26, 2017
- Messages
- 667
- Office Version
- 365
- Platform
- Windows
Hi all,
I use this code:-
I use this code:-
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
Dim rng As Range
For Each rng In Range("a2:f100")
Select Case rng.Value
Case "Compliant"
With Range("A" & rng.Row).Resize(1, 6)
.Interior.ColorIndex = 4
End With
Case "compliant"
With Range("A" & rng.Row).Resize(1, 6)
.Interior.ColorIndex = 4
End With
Case "WIP"
With Range("A" & rng.Row).Resize(1, 6)
.Interior.ColorIndex = 6
End With
Case "wip"
With Range("A" & rng.Row).Resize(1, 6)
.Interior.ColorIndex = 6
End With
Case "TBA"
With Range("A" & rng.Row).Resize(1, 6)
.Interior.ColorIndex = 44
End With
Case "tba"
With Range("A" & rng.Row).Resize(1, 6)
.Interior.ColorIndex = 44
End With
Case ""
With Range("A" & rng.Row).Resize(1, 6)
.Interior.ColorIndex = xlNone
End With
End Select
Next rng
If Not (Application.Intersect(Target, Range("A2:A1000")) _
Is Nothing) Then
With Target
If Not .HasFormula Then
Application.EnableEvents = False
.Value = UCase(.Value)
Application.EnableEvents = True
End If
End With
End If
End Sub
But want to insert this into:-
Worksheets("Sheet1").Columns("A:I").AutoFit
This is so the Columns in the range will 'Autofit' to the width of the longest data inserted .
Thank you all for your help.
KR
Trevor3007