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

沒有留言:

張貼留言

上市櫃營收年增率:202604

月年增率 115.04 上市櫃公司總營收與月年增率 月總營收 113/01 113/02 113/03 113/04 113/05 113/06 113/07 113/08 113/09 113/10 113/11 113/12 114/01 114/02 114/03 114/...