Thread: [Solved] recording ranges in macros
View Single Post
 
Old 09-04-2017, 02:20 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by ewso View Post
What would I replace the range with in the macro for it to always use the selected range I have at the time of running the macro?
That really depends on what the recorded macro does and what you're trying to achieve. In come cases, you could get away with just referring to a Selection. However, once you start moving around and, for example, modifying other cells whose choice based on their logical relationship to the set you initially selected or to some other feature of a worksheet, that's soon going to prove very inadequate.

If you look about this forum, you'll see many coding examples, the better of which rarely entail selecting anything; a hallmark of recorded macros is that whatever they affect gets selected and there's often a lot of worksheet scrolling activating, etc.

If you want specific advice regarding the problem you're trying to solve, describe it to us and post the code you've recorded.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote