Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

applying shading to rows using VBA

Posted on 2014-07-22
9
Medium Priority
?
103 Views
Last Modified: 2014-07-22
Dear Experts:

I got a list with thousands of rows with the following make-up. For example

Column A         Column B
90-234-58-75   Product A
Quantity            38
Marking            100    
90-234-58-59   Product B
Quantity            90
Marking            95    
etc.

I would like to apply shading to these  rows in an orderly/uniform manner using a VBA macro so that ...
... rows with the product numbers get a red shading ...
... the rows featuring the quantity get a grey shading
... the rows featuring the marking  get a dark grey shading

I have attached a sample file with details for your convenience.

Thank you very much for your great help.

Regards, Andreas

Row-Formatting-Macro.xlsx
0
Comment
Question by:AndreasHermle
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 24

Expert Comment

by:Steve
ID: 40211268
This can be done using conditional formatting.
Are you sure you only want a VBA solution?
0
 

Author Comment

by:AndreasHermle
ID: 40211328
Conditional Formatting, sounds interesting? But how is this done?
Thank you, Regards, Andreas
0
 

Author Comment

by:AndreasHermle
ID: 40211341
There is a slight error in my sample file
The 'Quantity' and 'Marking' entries are not mentioned in the sample table only in the shaded version of this table.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 24

Accepted Solution

by:
Steve earned 2000 total points
ID: 40211387
The attached file has Conditional Formatting > Based upon Formula.

This formatting is then set across A:B

Does this seem to work for you?
C--Users-shall-Desktop-Row-Formatting-Ma
0
 

Author Comment

by:AndreasHermle
ID: 40211452
Hi Steve,

thank you very much for your swift help. Unzipping your file results in strange file types.
But I managed to open the xml file and I could see the formulas behind the condtional formatting. I will try them out and let you know. This will take a while since I need to look after some other stuff right now. Thank you very much. Regards, andreas
0
 
LVL 24

Expert Comment

by:Steve
ID: 40211469
It shouldn't need unzipping....

It has probably just lost the .xlsx extension.
The expert exchange file name convention is a tad longer than it needs to be.
(an xlsx file is just a zipped folder in disguise)
C--Users-shall-Desktop-Example.xlsx
0
 

Author Comment

by:AndreasHermle
ID: 40211949
I've requested that this question be closed as follows:

Accepted answer: 0 points for AndreasHermle's comment #a40211452

for the following reason:

Hi Steve,

great, works like a charm, thank you very much for your great help. Regards, Andreas
0
 
LVL 24

Expert Comment

by:Steve
ID: 40211950
Andreas, it seems you have accepted your own solution and closed the question.

I guess in error after the comment that it works like a charm.

I have opened the question back up for you to hopefully allocate points to my solution.

Thanks,
Steve,
0
 

Author Closing Comment

by:AndreasHermle
ID: 40212005
Oooops, Steve, I am really sorry, my fault of course.

Also, Thank you for bringing this zip/xlsx issue to my attention.

Again, thank you very much for your great and professional help.

Regards, Andreas
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This article describes a serious pitfall that can happen when deleting shapes using VBA.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question