返回列表 上一主題 發帖

[發問] Excel VBS 設成共用活頁簿功能

[發問] Excel VBS 設成共用活頁簿功能

下方語法,是讓欄位輸入英文字母都會顯示大寫,但問題我把Excel設成「共用活頁簿」功能後,如下語法就會消失,那有其他辦法克服嗎?

Private Sub Worksheet_Change(ByVal Target As Range)
        If Intersect([A1:A2000,K1:K2000], Target) Is Nothing Then Exit Sub
        'if target.count > 1 then exit sub  '當 range 中的數量多於1個時離開
        Application.EnableEvents = False
        'Target = UCase(Target)  '修改1個欄位時適用
        '修改多個欄位時,需改成這樣
        for each c in target.cells
                c.value = ucase(c.value)
        next
        Application.EnableEvents = True
End Sub

        靜思自在 : 有時當思無時苦,好天要積雨來糧。
返回列表 上一主題