ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Setting cell colors using variables (https://www.excelbanter.com/excel-programming/424913-setting-cell-colors-using-variables.html)

John

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



All times are GMT +1. The time now is 11:45 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com