Solved

Set Interior.ColorIndex

Posted on 2012-03-30
3
229 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
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 Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

776 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