Code to insert functions not working anymore

M

Mike K

Oh Wise Ones,
I added some new code to my workbook last week, that
before I left was working fine. Today its returning an error. No one else
in my group messes with the code, just me. A routine inserts a row(at row 4)
and populates various columns. I added some code in additional columns
(semi-hidden with white font) to
filter by last 2 weeks, year to date, and total. Debug is now popping up on
my first line of new code. Not sure what to do since it did work last week.
Any thoughts?
My new code is from >> to >>

Mike

snippet from botton of routine:
RedDate = InputBox(Message, Title, Default)
Message = "Enter the pallet ID number"
Title = "Inventory Number"
Default = "NOI"
InvNum = InputBox(Message, Title, Default)
Worksheets("Red Tag").Range("H19,H45") = InvNum
Worksheets("Open Red Tags").Range("K4") = InvNum
Worksheets("Red Tag").Range("H40,H14") = Squares
Worksheets("Open Red Tags").Range("H4") = Squares
Worksheets("Red Tag").Range("H8,H34") = RedDate
Worksheets("Open Red Tags").Range("B4") = RedDate
Worksheets("Red Tag").Range("H20,H46") = Date
Worksheets("Open Red Tags").Range("J4") = Date14),H4,"")"
Worksheets("Open Red Tags").Range("N4").Font.ColorIndex = 2
Worksheets("Open Red Tags").Range("O4").Formula = "=IF(J4>$O$2,H4,"")"
Worksheets("Open Red Tags").Range("O4").Font.ColorIndex = 2
Worksheets("Open Red Tags").Range("P4").Formula = "=IF(J4>$I$1,J4,"")"TagNumber = Worksheets("Data").Range("G2")
TagNumber = TagNumber + 1
Worksheets("Data").Range("G2") = TagNumber
Worksheets("Red Tag").Range("H18,H44") =
Worksheets("Data").Range("G2")
Worksheets("Open Red Tags").Range("A4") =
Worksheets("Data").Range("G2")
Hide
UserForm2.Show
 
A

Ardus Petus

You must double the double-quotes within a string literal:
Worksheets("Open Red Tags").Range("N4").Formula =
"=IF(J4>(TODAY()-14),H4,"""")"

HTH
 
M

Mike K

Huh...Works perfectly. Thanks a bunch. Not sure why it worked that way last
week, but hey I'll take it. I love this group, I learn so much by working
with real problems.

Thanks again,
Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top