close

I have create macro command to performe following task:

Sub Macro1()
Range(quot;D1125,F11:F25,H11:H25quot;).Select
Range(quot;H11quot;).Activate
Selection.ClearContents
Range(quot;D10quot;).Select
End Sub

my question, can i add to request password or ask Yes or No to proceed the
command.

tq- param

Hi,

Try this code:

Sub Macro1()
myPWD = Application.InputBox(quot;Enter a numberquot;)
If myPWD = quot;NAVEENquot; Then
Range(quot;D1125,F11:F25,H11:H25quot;).Select
Range(quot;H11quot;).Activate
Selection.ClearContents
Range(quot;D10quot;).Select
Else
Msgbox quot;Wrong Password! Bye!quot;
End If
End Sub
Regards
NAVEEN

quot;Paramquot; wrote:

gt; I have create macro command to performe following task:
gt;
gt; Sub Macro1()
gt; Range(quot;D1125,F11:F25,H11:H25quot;).Select
gt; Range(quot;H11quot;).Activate
gt; Selection.ClearContents
gt; Range(quot;D10quot;).Select
gt; End Sub
gt;
gt; my question, can i add to request password or ask Yes or No to proceed the
gt; command.
gt;
gt; tq- param

TQ so much!

quot;NAVEENquot; wrote:

gt; Hi,
gt;
gt; Try this code:
gt;
gt; Sub Macro1()
gt; myPWD = Application.InputBox(quot;Enter a numberquot;)
gt; If myPWD = quot;NAVEENquot; Then
gt; Range(quot;D1125,F11:F25,H11:H25quot;).Select
gt; Range(quot;H11quot;).Activate
gt; Selection.ClearContents
gt; Range(quot;D10quot;).Select
gt; Else
gt; Msgbox quot;Wrong Password! Bye!quot;
gt; End If
gt; End Sub
gt;
gt;
gt;
gt; Regards
gt; NAVEEN
gt;
gt; quot;Paramquot; wrote:
gt;
gt; gt; I have create macro command to performe following task:
gt; gt;
gt; gt; Sub Macro1()
gt; gt; Range(quot;D1125,F11:F25,H11:H25quot;).Select
gt; gt; Range(quot;H11quot;).Activate
gt; gt; Selection.ClearContents
gt; gt; Range(quot;D10quot;).Select
gt; gt; End Sub
gt; gt;
gt; gt; my question, can i add to request password or ask Yes or No to proceed the
gt; gt; command.
gt; gt;
gt; gt; tq- param

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()