CaptainGravyBum
Board Regular
- Joined
- Dec 1, 2023
- Messages
- 77
- Office Version
- 365
- Platform
- Windows
Hello,
I have a macro set up to copy data from one sheet onto a new workbook before saving, but the command isn't copying just the data, it appears to be pulling in 200+ blank rows as well.
Is there a way to just copy the selected cells from sheet1?
Dim savePath As Variant
Dim newWb As Workbook
Dim newSheet As Worksheet
Dim sheetName As String
Dim currentDateAndTime As String
Dim defaultPath As String
Set ws = ThisWorkbook.Sheets("Sheet1")
currentDateAndTime = Format(Now(), "ddmmyyyy_hhmmss")
sheetName = ws.Name
Set newWb = Workbooks.Add
Set newSheet = newWb.Sheets(1)
ws.Cells.Copy newSheet.Cells
I have a macro set up to copy data from one sheet onto a new workbook before saving, but the command isn't copying just the data, it appears to be pulling in 200+ blank rows as well.
Is there a way to just copy the selected cells from sheet1?
Dim savePath As Variant
Dim newWb As Workbook
Dim newSheet As Worksheet
Dim sheetName As String
Dim currentDateAndTime As String
Dim defaultPath As String
Set ws = ThisWorkbook.Sheets("Sheet1")
currentDateAndTime = Format(Now(), "ddmmyyyy_hhmmss")
sheetName = ws.Name
Set newWb = Workbooks.Add
Set newSheet = newWb.Sheets(1)
ws.Cells.Copy newSheet.Cells