+ Reply to Thread
Results 1 to 2 of 2

Multiple Main Function calling one sub function in different ranges

  1. #1
    Registered User
    Join Date
    05-08-2018
    Location
    Netherlands
    MS-Off Ver
    MS 2013
    Posts
    15

    Multiple Main Function calling one sub function in different ranges

    Hey all,
    I am working on tidying up code finally!
    I have a single data page (Sheet 4), with (e.g Rows 1-10 = Case 1, Rows 11-15 = Case 2, Rows 16-23 = Case 3).

    Sheet 1 has button 1, Sheet 2 button 2, Sheet 3 button 3.

    All three buttons need to take column A Sheet 4 -> Paste it in last column Sheet 5. But only for their range (sheet 1 button = case 1 etc).

    Do I need to write 3 macros, exactly the same but with different ranges specified? Or can I have one macro that says "If button on sheet 1, then apply case 1. If button 2, apply case 2 etc).

    In actuality there are going to be several sub functions to each button, each doing the same thing but for different ranges, so not writing the same code lots of times with different ranges would be good!

    I can write all of the individual codes I need, just not sure how to call them as above.
    I can't upload any example yet as I wanted to see how to structure this before starting to write it all

    Hope this makes sense!
    Luke
    Last edited by LukeNZ; 06-12-2019 at 04:25 AM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Multiple Main Function calling one sub function in different ranges

    One way of many:

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

+ 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 function inside function. (aka nested function)
    By jakopak in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-02-2015, 05:58 AM
  2. Replies: 5
    Last Post: 09-15-2014, 12:41 AM
  3. [SOLVED] IF function with multiple ranges
    By Conan77 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-18-2014, 03:12 PM
  4. Macro exits prematurely from function after calling other function
    By LouisPhilippe in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-22-2013, 03:22 AM
  5. [SOLVED] help with calling a function (B) and return control of program flow to the calling functio
    By john/nyc in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 10-26-2012, 11:06 AM
  6. Calling multiple values from a function within a code
    By krish T in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-11-2010, 01:06 PM
  7. How can you use multiple ranges in a function?
    By solinar in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-03-2006, 06:48 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