LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default Calling procedures from within VBA

Excel Helper

I have a problem that I have never encountered before and could use some help.

In simple terms I want to run a procedure that calls another procedure
within that code. The procedure allows a worksheet to be added to a workbook,
with the user specifying a name via InputBox. However, before the worksheet
is added the procedure checks the 'value' of a given cell (cell S3). If that
= "ON" then some of the figures on the existing worksheet are changed
(divided by 10) and a menu item on a custom menu is updated (has a tick mark
next to it using msoButtonDown).

My code looks something like this:

Public Sub InsertSheet()
Dim answer As String

If Worksheets(Worksheets.Count - 2).Range("S3") = "ON" Then
Call ToggleRunRate
End If

answer = InputBox("Enter worksheet name", "Add Sheet")

....more code here...

End sub

The problem that I am having is as follows.

If cell S3 is not equal to 'ON' then the code works fine and I get a prompt
for the InputBox and all subsequent code does what it ought to.

If cell S3 equals 'OFF' then the procedure 'ToggleRunRate' executes as it
should but the InputBox does not appear. It is as if the procedure cannot
progress any further than Call ToggleRunRate, even though no error is
generated.

Some things that I would add that may help:

(1) I have checked the state of Application.ScreenUpdating to see if that is
preventing execution but all seems fine.
(2) The procedure ToggleRunRate is in a separate module. I have defined it
as Public. I don't see why this would make a difference?

I have never had this issue before. All I can think of is that because of
the operation that ToggleRunRate performs i.e. makes some calculations on a
worksheet and amends the appearance of a menu item, that this is in some way
interfering with the code?

I wonder if anybody has any suggestiins on this? I can give more details if
needed.

Regards


Alex Park




 
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
Event procedures: who is calling? Momo[_2_] Excel Programming 2 April 22nd 06 08:12 AM
calling procedures from worksheet buttons Anthony[_6_] Excel Programming 2 July 23rd 05 11:17 AM
Calling Procedures in other Projects SixSigmaGuy Excel Programming 3 November 5th 04 11:24 PM
Calling procedures in .xla projects Chris Excel Programming 1 July 16th 04 10:28 PM
Calling Procedures jrh Excel Programming 2 March 4th 04 03:34 PM


All times are GMT +1. The time now is 02:14 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"