Solved

Set Interior.ColorIndex

Posted on 2012-03-30
3
232 Views
Last Modified: 2012-03-30
Hello Experts,

I need to set my Interior.Color.Index to 15 for every other cell in my range starting with A5, after I set my sheet to merge cells.

So far I have my code as:

Private Sub MergeBlockNames()
   
    For i = 5 To 74 Step 2
    Range(Cells(i, 1), Cells(i + 1, 1)).Merge
    Next i

End Sub

I am confused how to add this next step - can you please help?
Thanks
0
Comment
Question by:mike637
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
kgerb earned 500 total points
ID: 37788302
You're question in a little unclear.  Is this what you're looking for?  If not we'll need some more explanation.
Private Sub MergeBlockNames()
Dim i As Long, j As Long
j = 1
For i = 5 To 74 Step 2
    j = j + 1
    With Range(Cells(i, 1), Cells(i + 1, 1))
        .Merge
        If j Mod 2 = 0 Then .Interior.ColorIndex = 15
    End With
Next i
End Sub

Open in new window

Kyle
0
 

Author Closing Comment

by:mike637
ID: 37788347
That was it!!

Thank you very much Kyle!
0
 
LVL 12

Expert Comment

by:kgerb
ID: 37788353
You're welcome.  Glad to help.
Kyle
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

856 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