Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Cut/Paste - Unwanted Macro Execution

I have a worksheet containing the headings Description, Quantity, Unit Cost
and Total Cost for columns B, C, D and E, resp. When an entry is made to the
C or D columns the following procedure runs to compute the Total Cost (C *
D).

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim vRange As Range
Set vRange = Range ("C:D")
If Not Intersect (Target, vRange) Is Nothing Then
Call CalcTotalCost €˜Multiply values in C and D resulting in E.
End If
End Sub

I would like to allow the user to manually cut the cells in B, C and D from
one row and paste into another. When I try to execute this cut/paste process
Excel seems to €œfreeze up€. This is undoubtedly caused be Excels attempt to
execute the code above.

Is there a way that the Worksheet_Change process can be suppressed when this
cut/paste sequence is performed? Other suggestions or alternate methodology
would be appreciated.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Cut/Paste - Unwanted Macro Execution

Possibly:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim vRange As Range
if Target.count 1 then exit sub
if Application.CutCopyMode then exit sub
Set vRange = Range ("C:D")
If Not Intersect (Target, vRange) Is Nothing Then
Call CalcTotalCost 'Multiply values in C and D resulting in E.
End If
End Sub

--
Regards,
Tom Ogilvy


"TooSimple" wrote in message
...
I have a worksheet containing the headings Description, Quantity, Unit Cost
and Total Cost for columns B, C, D and E, resp. When an entry is made to
the
C or D columns the following procedure runs to compute the Total Cost (C *
D).

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim vRange As Range
Set vRange = Range ("C:D")
If Not Intersect (Target, vRange) Is Nothing Then
Call CalcTotalCost 'Multiply values in C and D resulting in E.
End If
End Sub

I would like to allow the user to manually cut the cells in B, C and D
from
one row and paste into another. When I try to execute this cut/paste
process
Excel seems to "freeze up". This is undoubtedly caused be Excel's attempt
to
execute the code above.

Is there a way that the Worksheet_Change process can be suppressed when
this
cut/paste sequence is performed? Other suggestions or alternate
methodology
would be appreciated.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Cut/Paste - Unwanted Macro Execution

Thanks for the quick response, Tom. I'll give your suggestion a try.

"Tom Ogilvy" wrote:

Possibly:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim vRange As Range
if Target.count 1 then exit sub
if Application.CutCopyMode then exit sub
Set vRange = Range ("C:D")
If Not Intersect (Target, vRange) Is Nothing Then
Call CalcTotalCost 'Multiply values in C and D resulting in E.
End If
End Sub

--
Regards,
Tom Ogilvy


"TooSimple" wrote in message
...
I have a worksheet containing the headings Description, Quantity, Unit Cost
and Total Cost for columns B, C, D and E, resp. When an entry is made to
the
C or D columns the following procedure runs to compute the Total Cost (C *
D).

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim vRange As Range
Set vRange = Range ("C:D")
If Not Intersect (Target, vRange) Is Nothing Then
Call CalcTotalCost 'Multiply values in C and D resulting in E.
End If
End Sub

I would like to allow the user to manually cut the cells in B, C and D
from
one row and paste into another. When I try to execute this cut/paste
process
Excel seems to "freeze up". This is undoubtedly caused be Excel's attempt
to
execute the code above.

Is there a way that the Worksheet_Change process can be suppressed when
this
cut/paste sequence is performed? Other suggestions or alternate
methodology
would be appreciated.





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Cut/Paste - Unwanted Macro Execution

Your recommended code changes below seem to have solved my problem.

Thanks again for your help.

"Tom Ogilvy" wrote:

Possibly:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim vRange As Range
if Target.count 1 then exit sub
if Application.CutCopyMode then exit sub
Set vRange = Range ("C:D")
If Not Intersect (Target, vRange) Is Nothing Then
Call CalcTotalCost 'Multiply values in C and D resulting in E.
End If
End Sub

--
Regards,
Tom Ogilvy


"TooSimple" wrote in message
...
I have a worksheet containing the headings Description, Quantity, Unit Cost
and Total Cost for columns B, C, D and E, resp. When an entry is made to
the
C or D columns the following procedure runs to compute the Total Cost (C *
D).

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim vRange As Range
Set vRange = Range ("C:D")
If Not Intersect (Target, vRange) Is Nothing Then
Call CalcTotalCost 'Multiply values in C and D resulting in E.
End If
End Sub

I would like to allow the user to manually cut the cells in B, C and D
from
one row and paste into another. When I try to execute this cut/paste
process
Excel seems to "freeze up". This is undoubtedly caused be Excel's attempt
to
execute the code above.

Is there a way that the Worksheet_Change process can be suppressed when
this
cut/paste sequence is performed? Other suggestions or alternate
methodology
would be appreciated.





Reply
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
Unwanted code execution Rick Excel Discussion (Misc queries) 2 March 26th 10 02:14 PM
Macro Execution C Brandt Excel Discussion (Misc queries) 2 July 13th 07 07:23 AM
copy/paste excel to texteditor -> multi-line text cells gain unwanted double-quotes niz Excel Discussion (Misc queries) 1 October 14th 05 02:06 PM
Macro execution limit Benn Excel Programming 3 September 2nd 04 02:26 PM
Automatic execution of macro Paul-André Gollier Excel Programming 1 January 30th 04 09:03 PM


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

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

About Us

"It's about Microsoft Excel"