+ Reply to Thread
Results 1 to 3 of 3

naming a routine and calling it in another routine - not a loop

  1. #1
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Ky
    MS-Off Ver
    Excel 2013
    Posts
    344

    naming a routine and calling it in another routine - not a loop

    I have a user form with 24 option buttons (12 Yes, 12 No), and another 9 check boxes. I have individual routines for each time No, Yes, or a check box is selected (33 routines in all). I then have a four-line routine:

    Please Login or Register  to view this content.
    Basically, anytime a "No" option button or a check box is selected (true), the NamedCell value goes to "1"; otherwise, it stays at "0". So my question is, to keep the user form current with what the end user is doing (selecting yes/no and/or checking boxes), would I have to repeat this routine 33 times (once for each option button = No, once for = true, and once for the 9 check boxes) - OR - could a name the routine, and then with just one line (or so) of code, call that routine after each option button and check box sub?

    What I am not looking for is a loop - becasue a loop would only run once. I need something along the lines of a shortcut so I wouldn't have to paste my code 33 times and make my code even longer than it is. Something like - and I'm new and learning VBA - naming the those 4 lines as a string and then calling the string. Does that make sense?

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,620

    Re: naming a routine and calling it in another routine - not a loop

    try
    Please Login or Register  to view this content.
    and then where you would put all these lines just (of course use your checkboxname)
    Please Login or Register  to view this content.
    Best Regards,

    Kaper

  3. #3
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Ky
    MS-Off Ver
    Excel 2013
    Posts
    344

    Re: naming a routine and calling it in another routine - not a loop

    Perfect! Pretty simple, really, but I couldn't quite get it; making it an object (rather than a string) is where I was getting caught. Thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Calling a Browse routine from a UserForm
    By j_Southern in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-27-2015, 06:23 AM
  2. Problem calling routine from a class in an add-in
    By scottbass in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-04-2014, 10:07 AM
  3. [SOLVED] VBA Calling Another Sub Routine to Run
    By mowens74 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-15-2013, 12:34 PM
  4. Calling routine with name stored in string variable
    By Helge in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-16-2011, 12:07 PM
  5. Calling Routine by Variable Name
    By Caligula in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-20-2008, 11:44 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1