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

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Glad it's working & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,216,075
Messages
6,128,657
Members
449,462
Latest member
Chislobog

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