Excel Autofilter & Color formatting thru vbscript


Would like to set autofilter & color formatting based thru vbscript.

for example: would like to set
1. Autofilter from column A to I
2. A - B color in yellow, C - D green in color etc

Please advise how can I achieve this thru vbscript

Thanks in advance
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Wayne Taylor (webtubbs)Commented:
VBA or VB Script?

VBA (Visual Basic for Applications) is the code contained within MS Office applications.
VB Script is usually run from .vbs files, or ASP.

grind67Author Commented:
Hi Wayne, it is vb script (not Visual basic for applicatons)

If achieving thru VB script is NOT too hard then I would request this way
Please advise alternate way?
Basically, I create excel file thru an automated process (with header & data) and place it under a folder. If there is some mechanism (Windows/Microsoft office 2003 out of the box softwrae/Util) to apply this color format & autofilter...would try this way as well

Unfortunetly, I cannot use VB 6

grind67Author Commented:
Fully automated solutions...right from the excel file creation to autofilter & color formatting

Have done the Excel creation & sending email but only outstanding thing is autofilter & color formatting...I think it is bit tricky
Wayne Taylor (webtubbs)Commented:
Given a Worksheet object "xlWS", use this to apply the AutoFilter and color the interior of the columns....

    xlWS.Range("A:B").Interior.ColorIndex = 6    'yellow
    xlWS.Range("C:D").Interior.ColorIndex = 4    'green

Note: You may need to adjust the ColorIndex to match your color palette.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
grind67Author Commented:
HI Wayne, that was excellent. Solved my problem...thanks a lot
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.