tinkythomas
Active Member
- Joined
- Dec 13, 2006
- Messages
- 432
Hi,
I having problems figuring out what I'm doing wrong with this vba procedure.....
The string "Per Ground Rule" should have font color red after the procedure is run but is not. The reason this string is not within the select case is because sometimes there is additional text but not always! The other strings within the statement are colored red and ok.
Row 118 should have a colon at the end of the string but doesn't. Any string with "UNSCHEDULED MAINTENANCE" should just have 1 colon at the end.
I have been working on this for some time now and just can't see what I'm doing wrong? Any help would be greatly appreciated. Please see a sample of my worksheet.........
I having problems figuring out what I'm doing wrong with this vba procedure.....
Code:
Sub ConceptAlign()
Dim i As Long
Dim LR As Long
Application.ScreenUpdating = False
LR = Range("A" & Rows.Count).End(xlUp).Row
Range("H2:H" & LR).Formula = "=TRIM(G2)"
Range("H2:H" & LR).Copy
Range("G2").PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
Columns("H:H").ClearContents
For i = 1 To LR Step 1
Select Case Range("G" & i)
Case "RAMNARBB", "This Lower Level LCN shows up because of the Legacy MSG3 Table", "Data that exist at this level.", _
"This data is scheduled to be revised with IRCMS analysis to", "replace the existing legacy data.", _
"The Maintenance Concept for this LCN is located at the next", "higher assembly indenture Level LCN.", _
"Where applicable Maintenance Significant Consumables will be", "identified in Report 024 Pt2 at its own LCN indenture level", _
"-----------------------------------------------------------------", _
"This LCN has been identified as a Maintenance Significant", "Consummable because it is a lifed item:"
Range("G" & i).Font.ColorIndex = 3
End Select
For i = 1 To LR Step 1
If Range("G" & i).Value Like "*UNSCHEDULED MAINTENANCE*" Then
.Value = "UNSCHEDULED MAINTENANCE:"
ElseIf Range("G" & i).Value = "DEPOT LEVEL - SCHEDULED MAINTENANCE" Then
.Value = "DEPOT LEVEL - SCHEDULED MAINTENANCE:"
ElseIf Range("G" & i).Value Like "SYSTEM*" Or Range("G" & i).Value Like "*SCHEDULED MAINTENANCE:" Then
.Font.ColorIndex = 3
ElseIf Range("G" & i).Value Like "Per Ground Rule*" Then
.Font.ColorIndex = 3
ElseIf Range("G" & i).Font.ColorIndex<> 3 Then
.Value = String(23, " ") & Range("G" & i).Value
End If
Next
Application.ScreenUpdating = True
End Sub
Row 118 should have a colon at the end of the string but doesn't. Any string with "UNSCHEDULED MAINTENANCE" should just have 1 colon at the end.
I have been working on this for some time now and just can't see what I'm doing wrong? Any help would be greatly appreciated. Please see a sample of my worksheet.........
CONCEPT.XLS | |||||||||
---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | |||
110 | ss199 | A2913003001 | 0 | P | B | 57 | |||
111 | ss199 | A2913003001 | 0 | P | B | 58 | INTERMEDIATELEVEL-SCHEDULEDMAINTENANCE: | ||
112 | ss199 | A2913003001 | 0 | P | B | 59 | NONE. | ||
113 | ss199 | A2913003001 | 0 | P | B | 60 | |||
114 | ss199 | A2913003001 | 0 | P | B | 61 | UNSCHEDULEDMAINTENANCE: | ||
115 | ss199 | A2913003001 | 0 | P | B | 62 | NONE. | ||
116 | ss199 | A2913003001 | 0 | P | B | 63 | |||
117 | ss199 | A2913003001 | 0 | P | B | 64 | |||
118 | ss199 | A2913003001 | 0 | P | B | 65 | DEPOTLEVEL-SCHEDULEDMAINTENANCE | ||
119 | ss199 | A2913003001 | 0 | P | B | 66 | NONE. | ||
120 | ss199 | A2913003001 | 0 | P | B | 67 | |||
121 | ss199 | A2913003001 | 0 | P | B | 68 | UNSCHEDULEDMAINTENANCE:: | ||
122 | ss199 | A2913003001 | 0 | P | B | 69 | NONE. | ||
123 | ss199 | A2913003001001 | 0 | P | B | 1 | ThisLowerLevelLCNshowsupbecauseoftheLegacyMSG3Table | ||
124 | ss199 | A2913003001001 | 0 | P | B | 2 | Datathatexistatthislevel. | ||
125 | ss199 | A2913003001001 | 0 | P | B | 3 | |||
126 | ss199 | A2913003001001 | 0 | P | B | 4 | ThisdataisscheduledtoberevisedwithIRCMSanalysisto | ||
127 | ss199 | A2913003001001 | 0 | P | B | 5 | replacetheexistinglegacydata. | ||
128 | ss199 | A2913003001001 | 0 | P | B | 6 | |||
129 | ss199 | A2913003001001 | 0 | P | B | 7 | TheMaintenanceConceptforthisLCNislocatedatthenext | ||
130 | ss199 | A2913003001001 | 0 | P | B | 8 | higherassemblyindentureLevelLCN. | ||
131 | ss199 | A2913003001001 | 0 | P | B | 9 | |||
132 | ss199 | A2913003001001 | 0 | P | B | 10 | WhereapplicableMaintenanceSignificantConsumableswillbe | ||
133 | ss199 | A2913003001001 | 0 | P | B | 11 | identifiedinReport024Pt2atitsownLCNindenturelevel | ||
134 | ss199 | A2913003001001 | 0 | P | B | 12 | |||
135 | ss199 | A2913003001001 | 0 | P | B | 13 | PerGroundRule | ||
136 | ss199 | A2913003001001 | 0 | P | B | 14 | |||
137 | ss199 | A2913003001001 | 0 | P | B | 15 | |||
Sheet1 |