The Select method
Sheets(“Sheet1”).Activate (frist activate and then select)
Range(“A1:C12”).Select
The Copy and Paste methods
1)
Sub CopyRange()
Range(“A1:A12”).Select
Selection.Copy
Range(“C1”).Select
ActiveSheet.Paste
End Sub
2)
Sub CopyRange2()
Range(“A1:A12”).Copy Range(“C1”)
End Sub
The Clear method
deletes the contents of a range and all the cell formatting
Columns(“D:D”).Clear (ClearContents, ClearFormats)
The Delete method
Rows(“6:6”).Delete
Range(“C6:C10”).Delete xlToLeft/xlup
Sub ShowSelectionType()
Dim SelType As String
SelType = TypeName(Selection)
MsgBox SelType
End Sub
TheFile = Application.Path & “\EXCEL.EXE”
Sub GetFileSize()
Dim TheFile As String
TheFile = “c:\MSOFFICE\EXCEL\EXCEL.EXE”
MsgBox FileLen(TheFile)
End Sub
Total = Application.WorksheetFunction.Sum(Range(“A1:A12”))
Total = WorksheetFunction.Sum(Range(“A1:A12”))
Total = Application.Sum(Range(“A1:A12”))
No comments:
Post a Comment