宏观的 [英] Macro's
问题描述
我还能够录制一个效果相当好的宏并将其分配给图标/图像。如果我现在点击它,保护将在每个杂志中发布,我可以进行调整。但是如果我点击它,我就是这样,
我必须先输入密码。我该怎么做?
I have also been able to record a macro that works reasonably well and have assigned it to an icon / image. If I click on it now, the protections will be released in every magazine and I can make adjustments. But I would just like that if I click on it, that I must first enter a password. How should I do that?
下面是我录制的宏。 grt,
Stavros
Sub Aanpassen()
'
'Aanpassen Macro
'
'
ActiveSheet.Unprotect
Application.DisplayFormulaBar = True
表格("Januari")。选择
  ActiveSheet.Unprotect
表格("Februari")。选择
  ActiveSheet.Unprotect
表格("Maart")。选择
  ActiveSheet.Unprotect
表格("四月")。选择
  ActiveSheet.Unprotect
表格("Mei")。选择
  ActiveSheet.Unprotect
表格("Juni")。选择
  ActiveSheet.Unprotect
表格("Juli")。选择
  ActiveSheet.Unprotect
表格("Augustus")。选择
  ActiveSheet.Unprotect
表格("九月")。选择
  ActiveSheet.Unprotect
表格("Oktober")。选择
  ActiveSheet.Unprotect
表格("十一月")。选择
  ActiveSheet.Unprotect
表格("十二月")。选择
 范围("J20")。选择
 表格("十二月")。选择
  ActiveSheet.Unprotect
表格("Ziekte")。选择
  ActiveSheet.Unprotect
表格("Verloven& Rusten")。选择
  ;   ActiveSheet.Unprotect
表格("主页")。选择
ActiveSheet.Unprotect
结束子
推荐答案
我想有几种方法可以完成你想做的事。
其中一个,也许是最简单的一个:
Hi,
I suppose there are several ways to accomplish what you want to do.
One of them, maybe one of the easiest is this:
Sub Aanpassen()
Dim pw As String
pw = InputBox("input password")
If (pw = "yourPassword") Then
MsgBox "invalid password"
Exit Sub
End If
.....
End Sub
问候,
这篇关于宏观的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!