I'd like to copy Rows and Columns of a worksheet to a new workbook. I can open and activate the new book and new sheets, but the data I am copying is currently A1:F520 on one sheet and A1:G1031 on another. There are multiple blanks in between and within several "groups" of data sets.
For the sake of the visual organization of our data, I want to keep those blanks in. The ranges will be changing over time, so I don't want to define something specific. I'd rather keep it general like Range("A1", Range("A1".End(xlDown)). I suppose I could just include some ridiculously large range to ensure everything is there, but I'd rather accomplish this in a more dynamic (if that is the right word) sort of way.
This is what I have so far:
Option Explicit
Public LGSheet As Worksheet
Public SGSheet As Worksheet
Public NewWorkbook As Workbook
Public UserYear As Integer
Sub DefineYear()
UserYear = Application.InputBox(Prompt:="Set Date for New Workbook", Type:=1)
Set NewWorkbook = Workbooks.Add
Set SGSheet = Worksheets.Add
Set LGSheet = Worksheets.Add
Call PasteLGTandSGT
End Sub
Sub PasteLGTandSGT()
Workbooks("Finished Products YTD Generator").Activate
Worksheets("LGT").Activate
Range("A1", Range("A1").End(xlDown)).Copy
LGSheet.Activate
Obviously I've put the xlDown bit here, and my google-fu isn't strong enough to find out anything more.
End(xlUp)
from the bottom of the sheet - that will preserve the gaps – Tim Williams