我有下面的代码在工作预算模板中工作。但是,在向所有用户推广之前,我需要让它对 Mac 友好。由于 Mac 不喜欢 ActiveX 控件,因此我试图找出一种方法来使此代码使用表单控件工作。有人对我有什么想法吗?谢谢!
Private Sub travelcalc_Click()
ActiveSheet.Unprotect Password:="PASSWORD"
If Me.travelcalc.Value = False Then
Range("C19:L20").Locked = False
Sheets("Travel Calculator").Visible = False
Else
Sheets("Travel Calculator").Visible = True
Range("$C$19") = Worksheets("Travel Calculator").Range("$N$25")
Range("$D$19") = Worksheets("Travel Calculator").Range("$P$25")
Range("$E$19") = Worksheets("Travel Calculator").Range("$R$25")
Range("$F$19") = Worksheets("Travel Calculator").Range("$T$25")
Range("$G$19") = Worksheets("Travel Calculator").Range("$V$25")
Range("$H$19") = Worksheets("Travel Calculator").Range("$X$25")
Range("$I$19") = Worksheets("Travel Calculator").Range("$Z$25")
Range("$J$19") = Worksheets("Travel Calculator").Range("$AB$25")
Range("$K$19") = Worksheets("Travel Calculator").Range("$AD$25")
Range("$L$19") = Worksheets("Travel Calculator").Range("$AF$25")
Range("$C$20") = Worksheets("Travel Calculator").Range("$N$51")
Range("$D$20") = Worksheets("Travel Calculator").Range("$P$51")
Range("$E$20") = Worksheets("Travel Calculator").Range("$R$51")
Range("$F$20") = Worksheets("Travel Calculator").Range("$T$51")
Range("$G$20") = Worksheets("Travel Calculator").Range("$V$51")
Range("$H$20") = Worksheets("Travel Calculator").Range("$X$51")
Range("$I$20") = Worksheets("Travel Calculator").Range("$Z$51")
Range("$J$20") = Worksheets("Travel Calculator").Range("$AB$51")
Range("$K$20") = Worksheets("Travel Calculator").Range("$AD$51")
Range("$L$20") = Worksheets("Travel Calculator").Range("$AF$51")
Range("C19:L20").Locked = True
End If
ActiveSheet.Protect Password:="PASSWORD", AllowFormattingColumns:=True, AllowFormattingRows:=True
End Sub