General discussion

  • Creator
    Topic
  • #2129354

    select range excel macro

    Locked

    by james.hess ·

    I can build a MicroSoft Excel 2000 macro to perform a function on a single cell that I select/highlight , on a column that I define or on a range of cells that I predefine in the macro. How can I write a macro so that it is dynamic enough to only run on a range of cells that I highlight with my mouse. I only want it to be performed on the range that I highlight / select, each time it may be a different range or worksheet.

All Comments

  • Author
    Replies
    • #3442999

      select range excel macro

      by dklippert ·

      In reply to select range excel macro

      This is the difference between Absolute and Relative addressing.
      Record a macro. When the little Stop recording tooolbar appears, notice the button on the right. That toggles the address mode. You want Relative Reference. When you record in this fashion, the macro will only work on the area you select.

      • #3444084

        select range excel macro

        by james.hess ·

        In reply to select range excel macro

        I’m confused. I click on the little box in the stop toolbar. it shows relative, but I can’t get it toggle to something other than relative.

        How do I record in a mode that will support in a mode that will be dynamic and permit me to highlight any area of cells.

    • #3424469

      select range excel macro

      by dklippert ·

      In reply to select range excel macro

      I mislead. Just select a range, record your macro and then stop it. The applicable piece of code is Selection. As long as you don’t move to another spot before stoping, the macro will be universal.
      As far as recording Absolute vs relative:

      By default it records as absolute. Try it both ways.
      Record a macro an click on the relative button.
      Go to cell A1 and color it Red.
      Do it again and click on the Relative button again You can see if it’s “pushed in” or not.
      One macro will jump to thesame location, the other will offset relative to the active cell.

    • #3436297

      select range excel macro

      by james.hess ·

      In reply to select range excel macro

      This question was closed by the author

Viewing 2 reply threads