Friday, August 30, 2013

(More) Tips, Tricks and Traps for the Excel.Range

 
1.       How to determine the address of a  range
? ActiveCell.Address()
 
2.       How to remove  formatting  in a range(cell)
ActiveCell.ClearFormats
 
3.       How to create a union of ranges(merge cells)
Range("A1:G5").Select
 
4.       How to select an entire column of range
Range("A1:D5").Columns(2).Select
 
5.       How to select an entire row of range
Range("A1:D5").Rows(3).Select
 
6.       How to test if a cell is Not populated with data
?  IsEmpty(ActiveCell.Value)
 
7.       How to test to see if cell is populated with a valid date
?  IsDate(ActiveCell.Value)
                               
8.       How to determine if a cell contains number(s)
? IsNumeric("hello")
 
9.       How to  copy the content of  a cell to another range
Activecell.Copy Destination:=ActiveCell.Offset(2,1)
 
10.   How to perform a PasteSpecial  operation from the contents copied to the Clipboard (via Control+C)
Activecell.Copy
ActiveCell.Offset(4,1).PasteSpecial(xlPasteAll)