Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional Formatting

Status
Not open for further replies.

Blorf

Programmer
Joined
Dec 30, 2003
Messages
1,608
Location
US
Hello. I have a form that I am using to enter production schedule data. Data sheet form, with headers that have the date, and qty scheduled total. I want the cells for each date to highlight green if the date falls on a weekend, so I made a fake conditional format for each of my 99 fields, and used this:

For I = 0 To 99
ZC="Weekday(Date()+"&I & ")=1 Or Weekday (Date()+"&I&")=7"
Me("" & I).FormatConditions(0).Expression1 = ZC

ZC ends up being "Weekday(Date()+1)=1 Or Weekday (Date()+1)=7"

I get an error that says wrong number of arguments, or bad assignment. This seems like it should work, so I think I am missing something.

Thanks for the help,
ChaZ

There Are 10 Types Of People In The world:
Those That Understand BINARY And Those That Don’t.

 
Hi. Found the solution

With Forms("New_Entry").Controls("" & I).FormatConditions
.Add(acExpression, , "" & ZC)
.BackColor = 65280
End With

Now I just need to figure out why it runs so slow!

Thanks,
ChaZ

There Are 10 Types Of People In The world:
Those That Understand BINARY And Those That Don’t.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top