Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Working with Ranges
The examples in this section demonstrate how to manipulate worksheet ranges with VBA.
Specifically, I provide examples of copying a range, moving a range, selecting a range, identifying types of information in a range, prompting for a cell value, determining the first empty cell in a column, pausing a macro to allow the user to select a range, counting cells in a range, looping through the cells in a range, and several other commonly used range-related operations.
Copying a range
Excel's macro recorder is useful not so much for generating usable code, but for discovering the names of relevant objects, methods, and properties. The code that's generated by the macro recorder isn't always the most efficient, but it can usually provide you with several clues.