+ Reply to Thread
Results 1 to 2 of 2

Use Specific cells as arguments in macros

  1. #1
    Registered User
    Join Date
    10-13-2020
    Location
    Daytona Beach, FL
    MS-Off Ver
    Office 2016
    Posts
    7

    Use Specific cells as arguments in macros

    Hi there,

    My understanding of macro arguments is limited, so let me lay out what I want to do.

    I want to make a function with an argument CopyAndPasteAsValue(Cell), where I can call the macro CopyandPasteAsValue(Cell) to whatever cell I need.

    I plan on using this macro for multiple things, so I figured it would be better to write a macro with an argument that I can call, rather than write every specific function over and over.

    Can I get some help with the architecture for this?

    1. How should I declare this macro?

    2. How do I use the specific Cell argument in the macro?

    3. How should I call this macro from other macros?

    Thanks for the help y'all. Always enjoy hearing your inputs.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,694

    Re: Use Specific cells as arguments in macros

    Your Sub is called CopyAndPasteAsValue, which means you need a place to copy from and a place to copy to. But you only have one cell as an argument. Is that the source or destination? And what is the other one?

    Here is an example that may give you enough information.

    This sub will copy from Cell and paste to whatever is the active cell selected by the user at the time this is called.

    Please Login or Register  to view this content.
    Here is an example of how you can call it:

    Please Login or Register  to view this content.
    For a more specific answer, provide more details about what you are doing.

+ 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. Passing arguments to macros from sheets
    By zilliman in forum Excel General
    Replies: 2
    Last Post: 02-26-2017, 03:00 AM
  2. How to set up multiple macros to print specific cells
    By lynds88 in forum Excel General
    Replies: 2
    Last Post: 02-27-2016, 06:19 AM
  3. [b]clear specific or range of cells before macros' run[/b]
    By chergian in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-13-2014, 11:21 PM
  4. Macros replace if arguments
    By Bakar in forum Excel General
    Replies: 2
    Last Post: 02-19-2012, 12:55 PM
  5. Replies: 4
    Last Post: 08-21-2006, 01:40 PM
  6. [SOLVED] relative versus specific cells in macros/vba
    By Stutsman in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-17-2006, 05:05 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