General discussion

Locked

select range excel macro

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.

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

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.

Collapse -

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.

Collapse -

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.

Collapse -

select range excel macro

by james.hess In reply to select range excel macro

Poster rated this answer

Collapse -

select range excel macro

by james.hess In reply to select range excel macro

This question was closed by the author

Back to Desktop Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums