Setting full address of file:
Dim str, filePath As String
str = ThisWorkbook.Path & "\"
filePath = str & "destination" & ".xlsx"
Dim str, filePath As String
str = ThisWorkbook.Path & "\"
filePath = str & "destination" & ".xlsx"
Opening workbook:
Dim wb As Workbook
Set wb = Workbooks.Open(filePath)
Clearing all contents,formats and comments for a sheet, say Sheet1:
wb.Worksheets("Sheet1").Cells.ClearContents
wb.Worksheets("Sheet1").Cells.ClearFormats
wb.Worksheets("Sheet1").Cells.ClearComments
Putting some data:
With wb.Worksheets("Sheet1")
Dim i As Integer
For i = 1 To 100
.Range("A" & i).Value = i
Next i
End With
Save and Close:
.Save
.Close
No comments:
Post a Comment