Copy sheet and get resulting sheet object?
Dim sht With ActiveWorkbook .Sheets(“Sheet1”).Copy After:= .Sheets(“Sheet2”) Set sht = .Sheets(.Sheets(“Sheet2”).Index + 1) End With
Dim sht With ActiveWorkbook .Sheets(“Sheet1”).Copy After:= .Sheets(“Sheet2”) Set sht = .Sheets(.Sheets(“Sheet2”).Index + 1) End With
You can get the row and column count using ExcelPackage (EPPlus.dll version 3.0.0.2) as below: var rowCnt = worksheet.Dimension.End.Row; var colCnt = worksheet.Dimension.End.Column;
You cannot append to an existing xlsx file with xlsxwriter. There is a module called openpyxl which allows you to read and write to preexisting excel file, but I am sure that the method to do so involves reading from the excel file, storing all the information somehow (database or arrays), and then rewriting when … Read more
Try this: Private Sub CreateSheet() Dim ws As Worksheet Set ws = ThisWorkbook.Sheets.Add(After:= _ ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)) ws.Name = “Tempo” End Sub Or use a With clause to avoid repeatedly calling out your object Private Sub CreateSheet() Dim ws As Worksheet With ThisWorkbook Set ws = .Sheets.Add(After:=.Sheets(.Sheets.Count)) ws.Name = “Tempo” End With End Sub Above can be … Read more