Data manipulation is one of the most common activities performed with Excel. Copy. Paste. Sort. Copy. Paste Special (values). Cut. Paste. Add Worksheet. Format range (bold). Sound familiar? This kind of process is a prime candidate for automation using VBA. Using the information presented in this and previous chapters, it's now within your reach to implement this kind of automation.

Cut, Copy, and PasteSpecial are germane to any process involving significant data manipulation. You use Cut when you want to move a range from one location to another whereas Copy is for copying (leaving the range in its original location and placing a copy in another location). PasteSpecial allows you to paste the contents of the clipboard to a given location. Using PasteSpecial, you can choose to paste only certain aspects of the clipboard such as values only, formulas, formats, or other aspects. When you're performing a lot of copying, keep in mind that you have another alternative— simply setting the Value property of one range equal to the Value property of another.

Between Find, Replace, SpecialCells, and Sort, you have a lot of power at your disposal for your various data manipulation needs. Don't let all of the parameters of these methods fool you into thinking they are difficult to use. Though they have many parameters, most of them are optional and you usually only use a few at a time.

In the next chapter, I'll wrap up coverage of the Excel object model by examining a handful of other common Excel objects including objects related to formatting, printing, and charts.

This page intentionally left blank

0 0

Post a comment