Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.CutCopyMode = False
End Sub
Re: Disable Fill Down, Right, Up.... Hi,
You could put that line of code in a sub so that when they
open the book it would run, then, you could put the reset
(=true) in a sub that runs when they close. They should be
instructed not to run other books while running your book
because you have taken control of the invironment.
To diable the control keys you could run the following
code...
> Dim KilledKeys As Variant
>
> Sub KillKeys()
> '' + = Shift ^ = Ctrl % = Alt
> KilledKeys = Array("+{F1}", "%{F1}", "+{F2}", "^
{F2}", "{F3}", _
> "^{F3}", "+{F3}", "{F4}", "+{F4}", "^
{F4}", "{F5}", "+{F5}", _
> "^{F6}", "{F7}", "^{F7}", "{F8}", "^{F8}", "+
{F8}", "{F9}", "^{F9}", _
> "+{F9}", "^{F10}", "{F11}", "^{F11}", "+
{F11}", "{F12}", "^{F12}", _
> "+{F12}", "^{PgDn}", "^{PgUp}")
> SetKeysSub KilledKeys, ""
> End Sub
>
> Sub SetKeysSub(KeyArray, Optional AssignedMacro As
Variant)
> Dim Counter As Integer
> If IsArray(KeyArray) Then
> For Counter = 0 To UBound(KeyArray)
> If IsMissing(AssignedMacro) Then
> Application.OnKey KeyArray(Counter)
> Else
> Application.OnKey KeyArray(Counter),
AssignedMacro
> End If
> Next
> Else
> If IsMissing(AssignedMacro) Then
> Application.OnKey KeyArray
> Else
> Application.OnKey KeyArray, AssignedMacro
> End If
> End If
>
> Sub ResetKilledKeys()
> SetKeysSub KilledKeys
> End Sub
Sub An()
Application.OnKey "^d", ""
End Sub
Sub Hien()
Application.OnKey "^d"
End Sub
Nếu làm như bạn thì khi muốn sử dụng lại thì mất công không.Mình có cách này bạn dùng thử xem: tạo 1 macro tên gì cũng được, trong nội dung của sub bạn không viết gì cả, sau đó gán phím tắt cho nó là Ctrl + D, thế là xong. Mình làm thử thấy được đó
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.CutCopyMode = False
Application.OnKey "^d", ""
' input box xuất hiện ở đây pass 123456
Application.CutCopyMode = True
Application.OnKey "^d"
End Sub
Cám ơn bác Footer
Em xin lỗi, bác xóa bài thừa giúp em với
Ký hiệu ^ bên cạnh "^d" là gì hả bác
Để thuận tiện hơn em muốn làm như sau
Khi có thao tác Paste (cho phép Cut) hoặc Ctrl + D thực hiện thì có một input box hiện ra, mình phải nhập pass (ví dụ: 12345) thì mới cho thực hiện còn không thì không thực hiện được kiểu như sau
Em đang bí với application.inputbox bác giúp em nhéPHP:Private Sub Worksheet_SelectionChange(ByVal Target As Range) Application.CutCopyMode = False Application.OnKey "^d", "" ' input box xuất hiện ở đây pass 123456 Application.CutCopyMode = True Application.OnKey "^d" End Sub
Cám ơn bác
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim pass As String
Application.CutCopyMode = False
Application.OnKey "^d", ""
pass = InputBox("Vui long nhap pass", "Pass ", "")
If pass = "12345" Then
Application.CutCopyMode = True
Application.OnKey "^d"
Exit Sub
End If
End Sub
Trời ơi sao bạn dùng sự kiện SelectionChange? Mỗi khi click nó đều hiện InputBox?
Cái này là theo ý bạn, mình không biết à nha
Mã:Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim pass As String Application.CutCopyMode = False Application.OnKey "^d", "" pass = InputBox("Vui long nhap pass", "Pass ", "") If pass = "12345" Then Application.CutCopyMode = True Application.OnKey "^d" Exit Sub End If End Sub