Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Inactivating a Sub Function

When I am using another Sub Function, I wants to inactivate another Sub
function.
Please suggest how can we do it?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Inactivating a Sub Function

You can use a boolean

Ad the top of your module add
Public stoprun As Boolean

In the sub you can set it to True and in the other one use this (first line)

If stoprun = True Then Exit Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Premanand" wrote in message ...
When I am using another Sub Function, I wants to inactivate another Sub
function.
Please suggest how can we do it?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Inactivating a Sub Function

Dear Mr.Ron de Bruin,
Thanks for your Immediate reply.
Let me explain for which reason I asked this question to you.
Actually, I am creatng an Excel Program with VBA in which I had 20 cells as
Data Input to the users. It will be blanked cells. Hence user will fill the
cells for results.
So the user should not avoid each cell as those cells are imperitus for
result.
Hence I wrote the program (in Sub Function) for the above protocal.
Now the problem is created for me. Actually I am having another command
button which will clear all the contents in the cells once if the program
shows the results. So by this time, I should use the suggestions given by
you. I feel better if you can advise in a brief manner further for this one.
Please do not mistake me.
Thankyou,
Regards,
Premanand.S

"Ron de Bruin" wrote:

You can use a boolean

Ad the top of your module add
Public stoprun As Boolean

In the sub you can set it to True and in the other one use this (first line)

If stoprun = True Then Exit Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Premanand" wrote in message ...
When I am using another Sub Function, I wants to inactivate another Sub
function.
Please suggest how can we do it?




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Inactivating a Sub Function

If you have a change event to fire when the cells are edited, then you can
suppress this with EnableEvents:

Private Sub CommandButton1_Click()
On Error goto ErrHandler
Application.EnableEvents = False
Range("A1:M20").ClearContents
ErrHandler:
Application.EnableEvents = True
End Sub

--
Regards,
Tom Ogilvy


"Premanand" wrote:

Dear Mr.Ron de Bruin,
Thanks for your Immediate reply.
Let me explain for which reason I asked this question to you.
Actually, I am creatng an Excel Program with VBA in which I had 20 cells as
Data Input to the users. It will be blanked cells. Hence user will fill the
cells for results.
So the user should not avoid each cell as those cells are imperitus for
result.
Hence I wrote the program (in Sub Function) for the above protocal.
Now the problem is created for me. Actually I am having another command
button which will clear all the contents in the cells once if the program
shows the results. So by this time, I should use the suggestions given by
you. I feel better if you can advise in a brief manner further for this one.
Please do not mistake me.
Thankyou,
Regards,
Premanand.S

"Ron de Bruin" wrote:

You can use a boolean

Ad the top of your module add
Public stoprun As Boolean

In the sub you can set it to True and in the other one use this (first line)

If stoprun = True Then Exit Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Premanand" wrote in message ...
When I am using another Sub Function, I wants to inactivate another Sub
function.
Please suggest how can we do it?




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Inactivating a Sub Function


I assume you want to run a macro from another macro


Application.Run "Book1!Macro1"
example:
Sub Macro4()
'
' Macro4 Macro
'
Range("G18").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-15]C:R[-1]C)"
Range("G19").Select

Application.Run "Book1!Macro1"

End Sub


--
davesexcel


------------------------------------------------------------------------
davesexcel's Profile: http://www.excelforum.com/member.php...o&userid=31708
View this thread: http://www.excelforum.com/showthread...hreadid=539633



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Inactivating a Sub Function

No Mr.Dave,
I wish to"not to run" a Sub function /Inactivate a Sub Function when I will
use another Function/Command Button.
I explained the program in detail in my previous thread.
Please Suggest me futher.
Regards,
Premanand Sethuraman.

"davesexcel" wrote:


I assume you want to run a macro from another macro


Application.Run "Book1!Macro1"
example:
Sub Macro4()
'
' Macro4 Macro
'
Range("G18").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-15]C:R[-1]C)"
Range("G19").Select

Application.Run "Book1!Macro1"

End Sub


--
davesexcel


------------------------------------------------------------------------
davesexcel's Profile: http://www.excelforum.com/member.php...o&userid=31708
View this thread: http://www.excelforum.com/showthread...hreadid=539633


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
Excel Data Validation/Lookup function does function correcty Kirkey Excel Worksheet Functions 2 May 25th 09 09:22 PM
copy of excel file not showing formulal/function in the function b oaallam Excel Discussion (Misc queries) 4 September 6th 07 01:20 PM
Inactivating of "Paste special" while linking charts klodvig Charts and Charting in Excel 0 September 11th 06 10:44 AM
LINKEDRANGE function - a complement to the PULL function (for getting values from a closed workbook) [email protected] Excel Worksheet Functions 0 September 5th 06 03:44 PM
Offset function with nested match function not finding host ss. MKunert Excel Worksheet Functions 1 March 21st 06 10:46 PM


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

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"