Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
sub routine | Excel Discussion (Misc queries) | |||
VBA routine (101) | Excel Programming | |||
SUB ROUTINE | Excel Programming | |||
Routine?? | Excel Programming | |||
Need VBA Routine | Excel Programming |