Whats the difference between using Select and Application Goto

The Select method of the Range object selects a range on the active worksheet only. Use Application.Goto to select a range on any worksheet in a workbook.

Application.Goto might or might not make another sheet the active sheet. The Goto method also lets you scroll the sheet so that the range is in the upper-left corner.

What's the difference between activating a range and selecting a range?

In some cases, the Activate method and the Select method have exactly the same effect. But in other cases, they produce quite different results. Assume that range A1:C3 is selected. The following statement activates cell C3. The original range remains selected, but C3 becomes the active cell — that is, the cell that contains the cell pointer.


Again, assuming that range A1:C3 is selected, the following statement selects a single cell, which also becomes the active cell.


Is there a quick way to delete all values from a worksheet yet keep the formulas intact?

Yes. The following code works on the active sheet and deletes all nonformula cells. (The cell formatting is not affected.)

On Error Resume Next

Cells.SpecialCells(xlCellTypeConstants, 23).ClearContents

Using On Error Resume Next prevents the error message that occurs if no cells qualify.

I know how to write a VBA instruction to select a range by using a cell address, but how can I write one to select a range if I know only its row and column number?

Use the Cells method. The following instruction, for example, selects the cell in the 5th row and the 12th column (that is, cell L5):

Cells(5, 12).Select

+1 0

Post a comment