Hi, I wonder whether someone may be able to help me please.
I'm using the code below to perform a number of actions to a series of columns within a given array.
Code
Sub MonthlyFormatSheets()
Dim ws As Worksheet
Dim rng As Range
Dim LastRow As Long
Const StartRow As Long = 5
For Each ws In Worksheets(Array("Monthly Projects", "Monthly Direct Activities", "Monthly Enhancements", "Monthly Indirect Activities", "Monthly Overheads"))
LastRow = ws.Cells(Rows.Count, "B").End(xlUp).Row
If LastRow >= StartRow Then
If ws.Name = "Monthly Projects" Then
ws.Range("B5:G" & LastRow).Cells.Font.Name = "Lucinda Sans"
ws.Range("B5:G" & LastRow).Cells.Font.Size = 10
ws.Range("E5:G" & LastRow).NumberFormat = "#,##0.000"
ws.Range("E5:G" & LastRow).HorizontalAlignment = xlCenter
ws.Range("G5:G" & LastRow).FormulaR1C1 = "=IF(RC[-2]<0.000,"""",RC[-2]-RC[-1])"
Display More
You'll see that in this line
I apply a formula and it's this that I'm having a little trouble with.
The formula works find but I'm trying to add conditional format, whereby if the value in column G is => 0.00 I'd like the font to be green, if it <0.00 then I'd like the font to be red.
I've done a fair bit of research, but I've been unable to find a sutiable solution which I can work at adapting.
I just wondered whether someone may be able to look at this please and offer some guidance on how I may go about achieving this.
Many thanks and kind regards