Discussion Locked

VBA (Excel) Sub Routines

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Using VBA (Excel)I am unable to run a sub routine which is called from another sub routine. I receive an error message saying the the sub routine i am calling cannot be found.

How can i automatically update the data a user inputs and as a resultautomatically rerun the program-recalculating the data.I guess in a similar fashion to the way Excel automatically recalculates formulas.

5 replies

by tclere

If the subroutine your are calling is in a different module, you need to make sure it is declared as a Public Sub.

I am not real sure what you are asking in the second portion of your post. If you want to rerun your subroutine when the user changes data, use the Worksheet_Change event for that worksheet.

by dsa

I do not know what your sub-routine is doing but a lot of times you can accomplish the same thing by creating two worksheets on the same workbook. Use one worksheet for data input and the other worksheet for computation and results based on the data in the input worksheet.

As a rule of thumb if you can accomplish the same thing without creating a VBA sub-routine you should try it first.

This discussion is closed to new replies.