• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 215
  • Last Modified:

Excel code Cell background Colour?

HI All

I am doing bit of code to Output Access query in Excel

I need way to change the colour of Excel cell as I put in data rows... am using code below..it hates it!!!

m_objWorkbook.ActiveSheet.Cells(lngRowCount, intCounter).Interior.ColorIndex = myColour

cheers

George

0
Homer1779
Asked:
Homer1779
1 Solution
 
CJ_SCommented:
Looks okay. What value is mycolour, lngRowCOunt and intCounter? Are those values okay?
0
 
NeutronCommented:
Hi Homer1779, :-)

I don't know much about Excel, but when I need it I usually use a nice trick to record a macro and then look in its source code.

This worked for me:

    With ActiveWorkbook.ActiveSheet.Cells(2, 3).Interior
        .Color = <somecolor>
        .Pattern = xlSolid
    End With

    With ActiveWorkbook.ActiveSheet.Cells(2, 3).Interior
        .ColorIndex = <index>
        .Pattern = xlSolid
    End With

'Don't know if this helps at all but hopefully you can test with your own macros and get what you need.

Greetings,
    </ntr> :)
0
 
Homer1779Author Commented:
Neutron I tried recording macro but mind this is in Excel..... I want to use it from Access that means using Excel references...complete pain!!!
0
Industry Leaders: 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!

 
nico5038Commented:

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
 - PAQ'd and pts refunded
Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

Nic;o)
0
 
Homer1779Author Commented:
Nic....

I solved this problem in the summer time

Its a pity the kill off question is not there anymore, it just makes the old questions hang about for ages and increases your workload

All the best

George
0
 
nico5038Commented:
Thanks for your reaction George.
Can you post perhaps the solution you found, then others with the same problem might be helped !

Thanks !

Nic;o)
0
 
JgouldCommented:
Question has been closed as per recommendation

JGould-EE Moderator
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now