Re: [算表] Excel:如何選取一個單元格後 整行底色變色(VBA)
試看看合不合適囉 ...
Dim Pre_Row As Integer
Dim Pre_color As Integer
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If (Pre_Row > 0) And (Rows(Pre_Row).Interior.ColorIndex = 35) Then
Rows(Pre_Row).Interior.ColorIndex = Pre_color
End If
x = ActiveCell.Row
Pre_Row = x
If IsNull(Rows(x).Interior.ColorIndex) Then
Pre_color = 0
Else
Pre_color = Rows(x).Interior.ColorIndex
End If
Rows(x).Interior.ColorIndex = 35
End Sub
※ 引述《ntnl (本號)》之銘言:
: 軟體: Excel
: 版本: 2003 SP3
: 如何可以選取某一儲存格(cell)後,橫向的整行變顏色?
: 我原本上網找了一個VBA如下:
: Private Sub Worksheet_SelectionChange(ByVal Target As Range)
: Rows().Interior.ColorIndex = 0
: x = ActiveCell.Row
: Rows(x).Interior.ColorIndex = 35
: End Sub
: 但有一個問題
: 我無法再使用變更底色的功能了
: (選取第n行→變更底色為紅色→跳離第n行後,第n行又變回白色底色)
: 請問如何改變呢?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.131.84.79
推
03/24 17:51, , 1F
03/24 17:51, 1F
→
03/24 17:51, , 2F
03/24 17:51, 2F
→
03/24 18:05, , 3F
03/24 18:05, 3F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 3 篇):
Office 近期熱門文章
PTT數位生活區 即時熱門文章