首页 文章

将ColorIndex保存在变量中(VBA / Excel)

提问于
浏览
-1

我有一些代码可以改变整行的颜色,在选择单元格时突出显示它 . 问题是我希望行回到前面的颜色 .

Rows(ActiveCell.Row).Interior.ColorIndex = 15

这总是改变颜色15,但我想保持变量的前颜色在这里使用它 . 我该怎么做?

非常感谢 :)

1 回答

  • 0
    'declare your new variable 
    Dim anteriorColor 
    'set your new variable 
    anteriorColor = Rows(ActiveCell.Row).Interior.ColorIndex
    

相关问题