2025年5月3日 星期六

VBA:Worksheet_SelectionChange 工作表 觸發應用 (二)

自動設定格式,點選儲存格,自動設定成指定格式。

指定成正數為0.00格式,負數設定成(設定紅色)

 Private Sub Worksheet_SelectionChange(ByVal TARGET As Range)   

        If ISNUMERIC(TARGET )=TRUE Then                        

        ACTIVESHEET.RANGE(TARGET.ADDRESS).NumberFormatLocal = "0.00;[紅色](0.00)" 

      End If

End

OR

Private Sub Worksheet_SelectionChange(ByVal TARGET As Range)   

        If ISNUMERIC(TARGET )=TRUE Then                        

        TARGET.NumberFormatLocal = "0.00;[紅色](0.00)" 

      End If

End Sub

沒有留言:

張貼留言

我的雷達:20260304 突破海峽!!!

  2號指標也亮燈,就衝!!!!! 更新:20260307 過一段時間了,才敢貼交易明細 哈,因為跟外資持股對答案 2026/3/9 訊號再次出現(數字衝高到1617),就買買買買買買 但我還是豬頭買了台達化