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?
Wayne Taylor (webtubbs)Connect With a Mentor 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.

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
grind67Author Commented:
HI Wayne, that was excellent. Solved my problem...thanks a lot
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.