+ Reply to Thread
Results 1 to 3 of 3

Macro and sub marco variables

  1. #1
    Registered User
    Join Date
    06-15-2011
    Location
    Converse, TX
    MS-Off Ver
    Excel 2016
    Posts
    72

    Macro and sub marco variables

    Currently I have a singular macro that can be utilized across 6 different sheets, however, what I don't want to have to do is create 6 of the same macro and each is roughly 100+ lines. To simply for the sake of this thread, if a button is pressed I have an If Then statement setup to check to see if the code matches a cell value. If it matches then what I would ideally like for it to do is run the macro with the specific sheet in mind.

    Here is a very basic version of the code that I am currently trying to hash out:
    Please Login or Register  to view this content.
    When I run it currently it keeps returning an error 'Object Required' which I attribute as to the 'Set wk =' not carrying over to the subroutine. Is there a way to call it in the sub routine or is it something that needs to be declared for each routine that is ran?

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Macro and sub marco variables

    Please Login or Register  to view this content.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    06-15-2011
    Location
    Converse, TX
    MS-Off Ver
    Excel 2016
    Posts
    72

    Re: Macro and sub marco variables

    Awesome! Thanks! I didn't realize how close I was and how just a few missed keystrokes was all I needed!

+ 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. [SOLVED] Excel Marco How to put multiple rows text values into single cell using macro
    By spa3212 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-03-2015, 09:49 AM
  2. [SOLVED] Noob using marco, I need to clear what my previous macro copied before pasting my new one
    By Slinky84 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-16-2014, 01:35 PM
  3. Email macro sending Two emails for each marco execution
    By Vlad717 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-30-2014, 01:27 PM
  4. How to create a Marco to run same Marco run on everysheet.
    By chriskingkiller in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-09-2013, 02:53 AM
  5. macro that finds variables in one column and enters values if variables found
    By xln00b in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-07-2010, 08:22 AM
  6. Macro Help:Marco pastes
    By annannienann in forum Excel General
    Replies: 1
    Last Post: 04-29-2005, 02:29 AM
  7. [SOLVED] Simple macro help-built a marco to open a daily text file
    By lars in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-05-2005, 02:06 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