Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default ignoring a sub routine

i have two subroutines
1. on double click insert a line using Private Sub
Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

2. on enter resize cells (as some of my cells are merged and autofit does
not work) - using rivate Sub Worksheet_Change(ByVal Target As Range) function.

The issue i have is when calling function/sub 1, function/sub 2 is
automatically activated and causes an error.
is there a way that i can have function/sub one ignore function/sub 2.

Thanx in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default ignoring a sub routine

Try:

Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
'code
End Sub

--
---------------------------
Mauro Gamberini
http://www.riolab.org/
"SU123" ha scritto nel messaggio
...
i have two subroutines
1. on double click insert a line using Private Sub
Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

2. on enter resize cells (as some of my cells are merged and autofit does
not work) - using rivate Sub Worksheet_Change(ByVal Target As Range)
function.

The issue i have is when calling function/sub 1, function/sub 2 is
automatically activated and causes an error.
is there a way that i can have function/sub one ignore function/sub 2.

Thanx in advance



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default ignoring a sub routine

this wont actually work, because the issue becomes, by calling the second sub
routine, the relative place of the cursor changes and this makes the routines
very complex.

i did give it a try, and received the same error - which is caused due to
the relative cell position.

any other ideas.

"Mauro Gamberini" wrote:

Try:

Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
'code
End Sub

--
---------------------------
Mauro Gamberini
http://www.riolab.org/
"SU123" ha scritto nel messaggio
...
i have two subroutines
1. on double click insert a line using Private Sub
Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

2. on enter resize cells (as some of my cells are merged and autofit does
not work) - using rivate Sub Worksheet_Change(ByVal Target As Range)
function.

The issue i have is when calling function/sub 1, function/sub 2 is
automatically activated and causes an error.
is there a way that i can have function/sub one ignore function/sub 2.

Thanx in advance




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default ignoring a sub routine

If you've turned on "edit directly in the cell", then you'll be editing the cell
after you doubleclick on that cell.

If you hit the Escape key, then your second procedure doesn't fire, right?

You can add a line to stop going into edit mode after the doubleclick.

Option Explicit
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
Cancel = True
'rest of code here
End Sub


SU123 wrote:

i have two subroutines
1. on double click insert a line using Private Sub
Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

2. on enter resize cells (as some of my cells are merged and autofit does
not work) - using rivate Sub Worksheet_Change(ByVal Target As Range) function.

The issue i have is when calling function/sub 1, function/sub 2 is
automatically activated and causes an error.
is there a way that i can have function/sub one ignore function/sub 2.

Thanx in advance


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default ignoring a sub routine

Disable events

Application.EnableEvents = false

and reset to true after.

--
__________________________________
HTH

Bob

"SU123" wrote in message
...
this wont actually work, because the issue becomes, by calling the second
sub
routine, the relative place of the cursor changes and this makes the
routines
very complex.

i did give it a try, and received the same error - which is caused due to
the relative cell position.

any other ideas.

"Mauro Gamberini" wrote:

Try:

Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
'code
End Sub

--
---------------------------
Mauro Gamberini
http://www.riolab.org/
"SU123" ha scritto nel messaggio
...
i have two subroutines
1. on double click insert a line using Private Sub
Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

2. on enter resize cells (as some of my cells are merged and autofit
does
not work) - using rivate Sub Worksheet_Change(ByVal Target As Range)
function.

The issue i have is when calling function/sub 1, function/sub 2 is
automatically activated and causes an error.
is there a way that i can have function/sub one ignore function/sub 2.

Thanx in advance








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default ignoring a sub routine

Dave
i have that in the code already, but the issue occurs when i want to add a
new line.

when adding the new line, it checks the bolean, but as i select the cells to
copy and paste, it then tries to resize them (i.e. calls the 2nd procedure).

is there a way to add a bolean to the worksheet_change routine, as that i
believe would solve the issue.


"Dave Peterson" wrote:

If you've turned on "edit directly in the cell", then you'll be editing the cell
after you doubleclick on that cell.

If you hit the Escape key, then your second procedure doesn't fire, right?

You can add a line to stop going into edit mode after the doubleclick.

Option Explicit
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
Cancel = True
'rest of code here
End Sub


SU123 wrote:

i have two subroutines
1. on double click insert a line using Private Sub
Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

2. on enter resize cells (as some of my cells are merged and autofit does
not work) - using rivate Sub Worksheet_Change(ByVal Target As Range) function.

The issue i have is when calling function/sub 1, function/sub 2 is
automatically activated and causes an error.
is there a way that i can have function/sub one ignore function/sub 2.

Thanx in advance


--

Dave Peterson

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default ignoring a sub routine


thanx Bob that worked a treat!
"Bob Phillips" wrote:

Disable events

Application.EnableEvents = false

and reset to true after.

--
__________________________________
HTH

Bob

"SU123" wrote in message
...
this wont actually work, because the issue becomes, by calling the second
sub
routine, the relative place of the cursor changes and this makes the
routines
very complex.

i did give it a try, and received the same error - which is caused due to
the relative cell position.

any other ideas.

"Mauro Gamberini" wrote:

Try:

Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
'code
End Sub

--
---------------------------
Mauro Gamberini
http://www.riolab.org/
"SU123" ha scritto nel messaggio
...
i have two subroutines
1. on double click insert a line using Private Sub
Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

2. on enter resize cells (as some of my cells are merged and autofit
does
not work) - using rivate Sub Worksheet_Change(ByVal Target As Range)
function.

The issue i have is when calling function/sub 1, function/sub 2 is
automatically activated and causes an error.
is there a way that i can have function/sub one ignore function/sub 2.

Thanx in advance






  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default ignoring a sub routine

It's not the doubleclicking that causes the trouble. It's what your code does.

But Bob answered that!

SU123 wrote:

Dave
i have that in the code already, but the issue occurs when i want to add a
new line.

when adding the new line, it checks the bolean, but as i select the cells to
copy and paste, it then tries to resize them (i.e. calls the 2nd procedure).

is there a way to add a bolean to the worksheet_change routine, as that i
believe would solve the issue.

"Dave Peterson" wrote:

If you've turned on "edit directly in the cell", then you'll be editing the cell
after you doubleclick on that cell.

If you hit the Escape key, then your second procedure doesn't fire, right?

You can add a line to stop going into edit mode after the doubleclick.

Option Explicit
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
Cancel = True
'rest of code here
End Sub


SU123 wrote:

i have two subroutines
1. on double click insert a line using Private Sub
Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

2. on enter resize cells (as some of my cells are merged and autofit does
not work) - using rivate Sub Worksheet_Change(ByVal Target As Range) function.

The issue i have is when calling function/sub 1, function/sub 2 is
automatically activated and causes an error.
is there a way that i can have function/sub one ignore function/sub 2.

Thanx in advance


--

Dave Peterson


--

Dave Peterson
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
sub routine Gord Dibben Excel Discussion (Misc queries) 0 November 13th 09 12:15 AM
VBA routine (101) Ray Excel Programming 5 August 26th 05 08:02 PM
SUB ROUTINE tokirk Excel Programming 1 January 19th 04 02:17 AM
Routine?? Zax Excel Programming 3 December 19th 03 05:50 PM
Need VBA Routine John M. Lembo Excel Programming 0 July 13th 03 01:51 AM


All times are GMT +1. The time now is 07:20 PM.

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"