+ Reply to Thread
Results 1 to 6 of 6

Calling macro 10 times, add header list to macro call only once

  1. #1
    Forum Contributor
    Join Date
    07-11-2010
    Location
    Minneapolis, USA
    MS-Off Ver
    Excel 2016
    Posts
    308

    Calling macro 10 times, add header list to macro call only once

    The 1st sub acts on columns by a array of header names

    I have to run the 2nd sub on numerous non-contiguous columns so I am calling it up the 10 different times.

    I would like to combine the first sub with the second so as to run the 2nd sub by a list of header names.

    I have tried combing them but have had no success, can't get how to use the"colToFormat" of the 1st sub in the 2nd sub.

    Thanks


    Please Login or Register  to view this content.

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor tony h's Avatar
    Join Date
    03-14-2005
    Location
    England: London and Lincolnshire
    Posts
    1,187

    Re: Calling macro 10 times, add header list to macro call only once

    I haven't looked at your code closely but assuminh you normally run the second sub includimg the range. Which seems to imply that by including this FillColBlanks colToFormat.Address in the first sub


    click on the * Add Reputation if this was useful or entertaining.

  3. #3
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Calling macro 10 times, add header list to macro call only once

    Try

    Please Login or Register  to view this content.
    You will have trouble taking the .Column property of a discontinuous range.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  4. #4
    Forum Contributor
    Join Date
    07-11-2010
    Location
    Minneapolis, USA
    MS-Off Ver
    Excel 2016
    Posts
    308

    Re: Calling macro 10 times, add header list to macro call only once

    mikerickson,

    I get "ByRef argument type mismatch"

    Call FillColBlanks(colToFormat) the "colToFormat" is highlighted in blue.

    Originally I would go Call FillColBlanks("H") so If I go Call FillColBlanks("colToFormat") instead I get "Type Mismatch"

    Thanks

  5. #5
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Calling macro 10 times, add header list to macro call only once

    Did you re-declare the argument of FillCollBlanks to type Range?

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    07-11-2010
    Location
    Minneapolis, USA
    MS-Off Ver
    Excel 2016
    Posts
    308

    Re: Calling macro 10 times, add header list to macro call only once

    I just double checked and I have
    Please Login or Register  to view this content.

+ 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 macro from change in Data Validation List
    By DavidBW in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-28-2014, 01:43 AM
  2. [SOLVED] Call "another Macro" multiple times
    By Simon.Ward in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-05-2013, 08:03 AM
  3. Create a loop to call macro a specified number of times
    By magito in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-09-2011, 09:18 PM
  4. Call macro using a data list
    By tink_ in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-16-2007, 11:58 PM
  5. Header Macro with a list box
    By om_119 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-15-2007, 05:41 PM

Tags for this Thread

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