UnsolvedCoding
Technical User
I have never had to code this before so if anyone knows how help would be greatly appreciated.
In the workbook there is a row of information that gets subtotatled by the years period. Beside that cell specific wording and formating must appear which is locked in because of downstream apps.
It should look like this in the cell:
Pre
12 Months
Expense
Export 254339
This sub will put that into a cell.
Sub Complete_Cell_Info()
ActiveCell.Formula = "Pre" & Chr(10) & "12 Months" & Chr(10) & "Expense" & Chr(10) & "Export 254339"
With ActiveCell.Characters(Start:=1, Length:=43).Font
.Name = "Calibri"
.FontStyle = "Regular"
.Size = 10
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
End Sub
However, because there are multipule possible expense locations the wording changes slightly and a constant doesn't seem to work.
Is there a way to get a constant to populate the cell or does it have to be broken out every time?
I tried this but VBA doesn't like it.
Const Expense = "Pre" & Chr(10) & "12 Months" & Chr(10) & "Expense" & Chr(10) & "Export 254339"
In the workbook there is a row of information that gets subtotatled by the years period. Beside that cell specific wording and formating must appear which is locked in because of downstream apps.
It should look like this in the cell:
Pre
12 Months
Expense
Export 254339
This sub will put that into a cell.
Sub Complete_Cell_Info()
ActiveCell.Formula = "Pre" & Chr(10) & "12 Months" & Chr(10) & "Expense" & Chr(10) & "Export 254339"
With ActiveCell.Characters(Start:=1, Length:=43).Font
.Name = "Calibri"
.FontStyle = "Regular"
.Size = 10
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
End Sub
However, because there are multipule possible expense locations the wording changes slightly and a constant doesn't seem to work.
Is there a way to get a constant to populate the cell or does it have to be broken out every time?
I tried this but VBA doesn't like it.
Const Expense = "Pre" & Chr(10) & "12 Months" & Chr(10) & "Expense" & Chr(10) & "Export 254339"