Solved

Excel VBA Format Color

Posted on 2014-04-06
4
455 Views
Last Modified: 2014-04-06
I need to format a row range: A1:T1, Color Green and Font Black on all worksheets except for 2 (Invoice Sheet and Summary Sheet).
0
Comment
Question by:shieldsco
[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
  • 2
  • 2
4 Comments
 
LVL 27

Accepted Solution

by:
MacroShadow earned 500 total points
ID: 39981649
Run this macro:
Sub Demo()

    Dim ws As Worksheet

    For Each ws In ActiveWorkbook.Worksheets
        If ws.Name <> "Invoice Sheet" And ws.Name <> "Summary Sheet" Then
            Range("A1:T1").Interior.Color = vbGreen
            Range("A1:T1").Font.Color = vbBlack
        End If
    Next
    
End Sub

Open in new window

0
 

Author Comment

by:shieldsco
ID: 39981679
The code formats the Invoice Sheet only
0
 
LVL 27

Expert Comment

by:MacroShadow
ID: 39981684
Sorry missing one line:
Sub Demo()

    Dim ws As Worksheet

    For Each ws In ActiveWorkbook.Worksheets
        If ws.Name <> "Invoice Sheet" And ws.Name <> "Summary Sheet" Then
            ws.Activate
            Range("A1:T1").Interior.Color = vbGreen
            Range("A1:T1").Font.Color = vbBlack
        End If
    Next

End Sub

Open in new window

0
 

Author Closing Comment

by:shieldsco
ID: 39981699
I figured it out. Code below:

For Each wsDst In ThisWorkbook.Sheets
        If wsDst.Name <> "Invoice" And wsDst.Name <> "Summary" Then
        With wsDst
            .Range("A1:T1").Interior.Color = vbGreen
            .Range("A1:T1").Font.Color = vbBlack
            End With
        End If
    Next
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

734 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