Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Setting Cell BackColors From VBA

Hi All. I need to create a spreadsheet from VBA in Access and set the
backcolors of certain cells depending on data values. All works well but how
do I set the cell/range back colors using VBA? Please Help.

Regards

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Setting Cell BackColors From VBA

Maybe this

Range("A1:A6").Interior.ColorIndex = 3
Mike

"AndrewDB" wrote:

Hi All. I need to create a spreadsheet from VBA in Access and set the
backcolors of certain cells depending on data values. All works well but how
do I set the cell/range back colors using VBA? Please Help.

Regards

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Setting Cell BackColors From VBA

Hi Mike,

Thanks for your quick response. Is there any way that I can set the color
using RGB value? Seems the colorindex range is very limited.

Andrew
--
Kepior Senso Fumor


"Mike H" wrote:

Maybe this

Range("A1:A6").Interior.ColorIndex = 3
Mike

"AndrewDB" wrote:

Hi All. I need to create a spreadsheet from VBA in Access and set the
backcolors of certain cells depending on data values. All works well but how
do I set the cell/range back colors using VBA? Please Help.

Regards

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Setting Cell BackColors From VBA

Andrew,

Look in Help for the different colours using RGB. This is Blue

Range("A1:A6").Interior.Color = RGB(0, 0, 255)

Mike

"AndrewDB" wrote:

Hi Mike,

Thanks for your quick response. Is there any way that I can set the color
using RGB value? Seems the colorindex range is very limited.

Andrew
--
Kepior Senso Fumor


"Mike H" wrote:

Maybe this

Range("A1:A6").Interior.ColorIndex = 3
Mike

"AndrewDB" wrote:

Hi All. I need to create a spreadsheet from VBA in Access and set the
backcolors of certain cells depending on data values. All works well but how
do I set the cell/range back colors using VBA? Please Help.

Regards

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Setting Cell BackColors From VBA

Hi Mike

For some reason my Access VBA does not accept the "= RGB(0,0,255)" code. I'm
using Access and Excell 2007.

Regards
Andrew

"Mike H" wrote:

Andrew,

Look in Help for the different colours using RGB. This is Blue

Range("A1:A6").Interior.Color = RGB(0, 0, 255)

Mike

"AndrewDB" wrote:

Hi Mike,

Thanks for your quick response. Is there any way that I can set the color
using RGB value? Seems the colorindex range is very limited.

Andrew
--
Kepior Senso Fumor


"Mike H" wrote:

Maybe this

Range("A1:A6").Interior.ColorIndex = 3
Mike

"AndrewDB" wrote:

Hi All. I need to create a spreadsheet from VBA in Access and set the
backcolors of certain cells depending on data values. All works well but how
do I set the cell/range back colors using VBA? Please Help.

Regards



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Setting Cell BackColors From VBA

Why not use the Excel built-in features of Conditional formatting?

Do you need it to be VBA?

Sub backcolor()
ActiveSheet.Range("A1:G23").Interior.ColorIndex = 3
End Sub


Gord Dibben MS Excel MVP

On Thu, 8 Oct 2009 07:25:01 -0700, AndrewDB
wrote:

Hi All. I need to create a spreadsheet from VBA in Access and set the
backcolors of certain cells depending on data values. All works well but how
do I set the cell/range back colors using VBA? Please Help.

Regards


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
setting cell values based on a 3rd cell Bob Excel Worksheet Functions 4 March 30th 10 08:53 PM
when setting a cell to equal a blank cell it displays 0 BWildeRed Excel Worksheet Functions 2 January 5th 10 07:04 AM
Dynamically setting CELL COLORS based on TWO OTHER cell values Tom Excel Discussion (Misc queries) 3 February 22nd 09 07:34 PM
Setting a cell equal to another worksheet cell fails (sometimes) Richard Excel Worksheet Functions 2 March 10th 06 04:11 AM
My cell will not advance to next cell setting at enter! Cell advance at enter Setting up and Configuration of Excel 2 October 14th 05 01:21 AM


All times are GMT +1. The time now is 04:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"