View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
John John is offline
external usenet poster
 
Posts: 2,069
Default Setting cell colors using variables

The following code colors my cells fine, but I want to specify the color
using a variable in the stmts so I can color cells differently.
Sheets(ToSht).Range(AcctTbl)(i, j).Interior.ThemeColor = lThemeColorAccent1
Sheets(ToSht).Range(AcctTbl)(i, j).Interior.TintAndShade =
0.799981688894314
I tried the following, but get type mismatch errors. What is the proper code?
Dim AcctCellColorTheme As String, AcctCellColor As String
AcctCellColorTheme = "xlThemeColorAccent1"
AcctCellColor = "0.799981688894314"
Sheets(ToSht).Range(AcctTbl)(i, j).Interior.ThemeColor =
AcctCellColorTheme
Sheets(ToSht).Range(AcctTbl)(i, j).Interior.TintAndShade = AcctCellColor

I appreciate your help, -John