Re: [算表] Excel:如何選取一個單元格後 整行底色變色(VBA)
將以下加到: ThisWorkbook 的右邊程式區,即可解決存檔的問題...
Dim Pre_Row As Integer
Dim Pre_color As Integer
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If (Pre_Row > 0) Then
If (Rows(Pre_Row).Interior.ColorIndex = 35) Then
Rows(Pre_Row).Interior.ColorIndex = Pre_color
End If
End If
End Sub
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As
Range)
If (Pre_Row > 0) Then
If (Rows(Pre_Row).Interior.ColorIndex = 35) Then
Rows(Pre_Row).Interior.ColorIndex = Pre_color
End If
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
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.229.87.154
→
03/24 22:11, , 1F
03/24 22:11, 1F
推
03/24 22:54, , 2F
03/24 22:54, 2F
討論串 (同標題文章)
完整討論串 (本文為第 3 之 3 篇):
Office 近期熱門文章
PTT數位生活區 即時熱門文章