Solved

Excel VBA Format Color

Posted on 2014-04-06
4
457 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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

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;…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
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 how to use longer labels with horizontal bar charts instead of the vertical column chart.

632 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