View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Sharad Sharad is offline
external usenet poster
 
Posts: 123
Default Copy & Paste Freezing Excel


In the code you posted, where is the Copy & Paste code?
All you are doing is remove border line.

Anyway, so the problem occurs when you Copy & Paste, right?
When you Copy and Paste the sheet, again the event Workbook_SheetChange
is fired. So it will run again. May be this is causing the freezing. Try
as under.

In Thisworkbook, General Section define a public variable as under:

Public notAgain As Boolean

Then in the Worksheet_Change add following two lines at TOP!
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Range)
If notAgain Then Exit Sub
notAgain = True

'your all code
'then following at the bottom before End Sub
notAgain = False
End Sub

Or if at any place in worksheet_change code you are using exit sub
(except for the one I told above at top)
just above exit sub enter line notAgain = False

Sharad



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!