(Created page with '==Clear contents of a range== ThisWorkbook.ActiveSheet.Columns("A:C").Select Selection.ClearContents ==Set a cell== ThisWorkbook.ActiveSheet.Range("A5").Value = "hel…') |
No edit summary |
||
Line 1: | Line 1: | ||
==Clear contents of a range== |
==Clear contents of a range== |
||
− | + | ThisWorkbook.ActiveSheet.Columns("A:C").Select |
|
Selection.ClearContents |
Selection.ClearContents |
||
==Set a cell== |
==Set a cell== |
||
− | + | ThisWorkbook.ActiveSheet.Range("A5").Value = "hello" |
|
==Auto fit a column== |
==Auto fit a column== |
||
− | + | ThisWorkbook.ActiveSheet.Columns("A:A").EntireColumn.AutoFit |
|
+ | |||
+ | ==Create Excel sheet from non-Excel app=== |
||
+ | Dim e As New Excel.Application: e.Application.Visible = True |
||
+ | Dim w As Excel.Workbook: Set w = e.Workbooks.Add |
||
+ | w.ActiveSheet.Range("A5").Value = "hello" |
Revision as of 00:57, 20 April 2010
Clear contents of a range
ThisWorkbook.ActiveSheet.Columns("A:C").Select Selection.ClearContents
Set a cell
ThisWorkbook.ActiveSheet.Range("A5").Value = "hello"
Auto fit a column
ThisWorkbook.ActiveSheet.Columns("A:A").EntireColumn.AutoFit
Create Excel sheet from non-Excel app=
Dim e As New Excel.Application: e.Application.Visible = True Dim w As Excel.Workbook: Set w = e.Workbooks.Add w.ActiveSheet.Range("A5").Value = "hello"