Hi,
I just started using VBA and macros today, so please be kind!
I have a set of data in column R, with an unknown number of rows that looks like this
Days Late
-28
150
3
16
41
.
.
.
and I have written a script to add an adjacent column "S". I want to fill column S with conditional values based on the value of column R, sorted into categories such as "On Time", "Less than One Month Late", etc. Here is what I have so far, it doesn't work:
Sub Open_Order_Days_Late_Category()
'
' Open_Order_Days_Late_Category Macro
'
'
Columns("S:S").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.ColumnWidth = 50
Select Case Range("R:R").Value
Case 1 To 6
Range("S:S").Value = "Less than one week late"
Case 7 To 14
Range("S:S").Value = "One to two weeks late"
Case 15 To 30
Range("S:S").Value = "Two weeks to one month late"
Case 31 To 60
Range("S:S").Value = "One to two months late"
Case 61 To 90
Range("S:S").Value = "Two to three months late"
Case 90 To 9999999
Range("S:S").Value = "More than three months late"
Case Else
Range("S:S").Value = "On Time"
End Select
Range("S1").Select
ActiveCell.FormulaR1C1 = "Days Late Category"
With ActiveCell.Characters(Start:=1, Length:=18).Font
.Name = "Calibri"
.FontStyle = "Bold"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontMinor
End With
End Sub
Can someone please help me fix this code to make it work?
Bookmarks