24周年

財(cái)稅實(shí)務(wù) 高薪就業(yè) 學(xué)歷教育
APP下載
APP下載新用戶掃碼下載
立享專屬優(yōu)惠

安卓版本:8.7.30 蘋(píng)果版本:8.7.30

開(kāi)發(fā)者:北京正保會(huì)計(jì)科技有限公司

應(yīng)用涉及權(quán)限:查看權(quán)限>

APP隱私政策:查看政策>

HD版本上線:點(diǎn)擊下載>

高亮顏色標(biāo)記單元格、行、列、行列實(shí)例

來(lái)源: 編輯: 2009/06/03 15:15:43  字體:

  1.高亮顏色標(biāo)記單元格

  VBA代碼:

  Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
  On Error Resume Next
  Cells.FormatConditions.Delete
  With Target.FormatConditions
  .Delete
  .Add xlExpression, , "TRUE"
  .Item(1).Interior.ColorIndex = Int(50 * Rnd() + 2)
  End With
  End Sub

  2.高亮顏色標(biāo)記行

  Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
  On Error Resume Next
  Cells.FormatConditions.Delete
  With Target.EntireRow.FormatConditions
  .Delete
  .Add xlExpression, , "TRUE"
  .Item(1).Interior.ColorIndex = Int(50 * Rnd() + 2)
  End With
  End Sub

  3.高亮顏色標(biāo)記列

  Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
  On Error Resume Next
  Cells.FormatConditions.Delete
  With Target.EntireColumn.FormatConditions
  .Delete
  .Add xlExpression, , "TRUE"
  .Item(1).Interior.ColorIndex = Int(50 * Rnd() + 2)
  End With
  End Sub

  4.高亮顏色編輯行列

  Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
  On Error Resume Next
  Cells.FormatConditions.Delete
  iColor = Int(50 * Rnd() + 2)
  With Target.EntireRow.FormatConditions
  .Delete
  .Add xlExpression, , "TRUE"
  .Item(1).Interior.ColorIndex = iColor
  End With
  With Target.EntireColumn.FormatConditions
  .Delete
  .Add xlExpression, , "TRUE"
  .Item(1).Interior.ColorIndex = iColor
  End With
  End Sub

責(zé)任編輯:zoe
回到頂部
折疊
網(wǎng)站地圖

Copyright © 2000 - m.jnjuyue.cn All Rights Reserved. 北京正保會(huì)計(jì)科技有限公司 版權(quán)所有

京B2-20200959 京ICP備20012371號(hào)-7 出版物經(jīng)營(yíng)許可證 京公網(wǎng)安備 11010802044457號(hào)