yurble_vn
09-12-2007, 10:01 AM
I have the following code in a worksheet to control change event, but when ever I try to copy cell by drag, i can not use autofill option: copy format only, or copy without format.
When check the undo icon, it is faded. Do the code disable undo?
is there anyway to use event code but still can use auto fill option?
Please help
Please help
Private Function IsOpen(FileName As String) As Boolean
' Determine if a workbook is open or not
Dim wb As Workbook
For Each wb In Application.Workbooks
If UCase(wb.Name) = UCase(FileName) Then
IsOpen = True
Exit Function
End If
Next wb
IsOpen = False
End Function
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error Resume Next
If Not Intersect(Target, Range("A1:G300")) Is Nothing Then
Range("I11").Interior.ColorIndex = 3
End If
If Not Intersect(Target, Range("J1:J6")) Is Nothing Then
Range("I11").Interior.ColorIndex = 3
End If
If Not Intersect(Target, Range("L1:R300")) Is Nothing Then
Range("I11").Interior.ColorIndex = 3
End If
End Sub
When check the undo icon, it is faded. Do the code disable undo?
is there anyway to use event code but still can use auto fill option?
Please help
Please help
Private Function IsOpen(FileName As String) As Boolean
' Determine if a workbook is open or not
Dim wb As Workbook
For Each wb In Application.Workbooks
If UCase(wb.Name) = UCase(FileName) Then
IsOpen = True
Exit Function
End If
Next wb
IsOpen = False
End Function
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error Resume Next
If Not Intersect(Target, Range("A1:G300")) Is Nothing Then
Range("I11").Interior.ColorIndex = 3
End If
If Not Intersect(Target, Range("J1:J6")) Is Nothing Then
Range("I11").Interior.ColorIndex = 3
End If
If Not Intersect(Target, Range("L1:R300")) Is Nothing Then
Range("I11").Interior.ColorIndex = 3
End If
End Sub