[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Set Interior.ColorIndex

Posted on 2012-03-30
3
Medium Priority
?
243 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
[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
3 Comments
 
LVL 12

Accepted Solution

by:
kgerb earned 2000 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

Technology Partners: 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!

Question has a verified solution.

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

This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
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…

649 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