ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Inserting Rows with the change event active (https://www.excelbanter.com/excel-programming/341421-inserting-rows-change-event-active.html)

KobusD

Inserting Rows with the change event active
 
Is there a similar statement as "If Application.CutCopyMode 0 Then
Exit Sub" that I can use in a worksheet change event to allow the
inserting of rows? (the program freezes)

I pressume that the problem occurs due to the fact that the program
'finds it difficult' to establish the TARGET cell. So maybe a way to
eliminate this parameter??


Norman Jones

Inserting Rows with the change event active
 
Hi KobusD,

It might help if you posted the problematic code.


---
Regards,
Norman



"KobusD" wrote in message
ups.com...
Is there a similar statement as "If Application.CutCopyMode 0 Then
Exit Sub" that I can use in a worksheet change event to allow the
inserting of rows? (the program freezes)

I pressume that the problem occurs due to the fact that the program
'finds it difficult' to establish the TARGET cell. So maybe a way to
eliminate this parameter??




KobusD

Inserting Rows with the change event active
 
Thanks for the reply, Norman. Here is the code:

Private Sub Worksheet_Change(ByVal Target As Range)

If Application.CutCopyMode 0 Then Exit Sub

'Turn calculation and screen updating off whilst the following code
executes
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False

'Unprotect the worksheet and disable the selection of locked cells
Worksheets("Output").Unprotect Password:="xxxxx"
Worksheets("Output(budgets)").Unprotect Password:="xxxxxx"

Worksheets("Budgets").CompileButt.BackColor = RGB(255, 0, 0)
Worksheets("Budgets").CompileButt.Caption = "Needs a Compile!"
Worksheets("Budgets").CompileButt.PrintObject = True

Worksheets("Output").Range("A2").Value = "A compile is outstanding!"
Worksheets("Output(budgets)").Range("F2").Value = "A compile is
outstanding!"

'Protect the worksheet and disable the selection of locked cells
Worksheets("Output").Protect Password:="xxxxx"
Worksheets("Output").EnableSelection = xlUnlockedCells
Worksheets("Output(budgets)").Protect Password:="xxxxxx"
Worksheets("Output(budgets)").EnableSelection = xlUnlockedCells

End Sub



All times are GMT +1. The time now is 05:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com