LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Why does a loop start ?

Please explain the reson why "Act" become = 0 after the pastespecial
operation and ws_change starts? The whole reason with the Act thing is that
it _should_prevent_a_loop_ when event ws_change happens. Look at the mark at
FormatTemp sub where it all go wrong....

I can't use "Application.eventenable = false" approach because it seem to
wipe out the clipboard... . I have no other worksheet_event etc in the
workbook.

/Thanks

Private Sub Worksheet_Change(ByVal Target As Range)
' *********
' Start a format restore operation when any change take place
' Act is used as a variable to prevent a loop when ForamtTemp causes any
changes
' *********
Dim Act As Integer
' "After the pastespecial in FormatTemp causes a change, a
' msgbox show Act = 0 here - why ?????"
If Not Act = 1 Then
Call FormatTemp
Else:
Exit Sub
End If
Act = 0
End Sub


Sub FormatTemp()
'**********
'SetSaveLoc and GetSaveLoc log and activate the current worksheet, workbook
and range
'**********
Dim Act As Integer
Act = 1
ActiveSheet.Unprotect
Call SetSaveLoc
Blad200.Unprotect
Blad200.Cells.Copy
ActiveSheet.Cells.Select ' Act = 1
Selection.PasteSpecial Paste:=xlPasteFormats,
Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

' HERE does the above action trigg worksheet_activate
' and make Act = 0 causing a loop of some reson - why? ????

ActiveSheet.Protect AllowFormattingCells:=False
ActiveSheet.EnableSelection = xlUnlockedCells
Call GetSaveLoc
End Sub


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
OT :Start your own online business today !start making dollars [email protected] Excel Discussion (Misc queries) 0 May 6th 06 09:29 PM
Start spreadsheet with WinXP start Gordon Gradwell Excel Worksheet Functions 1 July 13th 05 11:35 AM
Worksheet_Change - loop within a loop bgm Excel Programming 1 January 19th 04 01:27 PM
HELP!!!! Can't stop a loop (NOT an infinite loop) TBA[_2_] Excel Programming 3 December 14th 03 03:33 PM
From worksheet enter DO-Loop start & end code Bob Leonard[_2_] Excel Programming 1 December 1st 03 09:42 PM


All times are GMT +1. The time now is 11:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"