Works as formula but doesn't work as VBA

Pete2211

New Member
Joined
Mar 26, 2019
Messages
6
Hi.
I have the below code which isn't working in VBA.
The formula works perfectly as a formula placed manually in the cell but doesn't work as part of the macro.
It seems to be the "" at the end of the formula which is confusing it. Please can somebody help?

Code:
    Sub FillEXTEND()
Sheets("OVERDUE").Select
    range("M1").Select
Dim LastRowColumnJ As Long
LastRowColumnJ = Cells(Rows.Count, 1).End(xlUp).Row
range("M2:M" & LastRowColumnJ).Formula = "=IF(and(J2<=TODAY(),L2<=Today(),ROUND((TODAY()-L2)/7,1),[U][B][SIZE=4][I]""[/I][/SIZE][/B][/U])"
End Sub

As you can see from the coding, I'm an absolute beginner at this so please bare with me.
 
Good morning Fluff

Not sure what's happened here but it has worked this morning.
I didn't save the workbook between trials of your different suggestions, could that have caused the problem?
Anyway, it's working fine now even if I have no idea why.
 
Upvote 0

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Glad it's working & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,943
Messages
6,181,908
Members
453,071
Latest member
Gizmo2024

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top