I'm looking to define several dynamic ranges from multiple sheets. I'm getting the error 1004 "Application or Object definition error." My code works for any range where the sheet is active, and I've been able to make it work by activating each sheet and then define my dynamic range. But if my spreadsheet gets to big this can really slow my program down.
Please note the following:
- .CurrentRegion will not work as it will include many unnecessary rows and columns. The report will include regions of repeating columns due to different areas of production.
Is there a better method of defining my ranges to prevent from having to activate each sheet? Below is an example of some of the code I'm using.
Set Sony = ThisWorkbook.Worksheets("Report")
Set Prod = ThisWorkbook.Worksheets("Prod Report")
Prod.Activate
Set rng1 = Prod.Range(Range("C3"), Range("C3").End(xlDown).Offset(-1, 0))
Set rng2 = Prod.Range(Cells(1, 1), Cells(1, 52))
Sony.Activate
Set rng3 = Sony.Range(Range("B4"), Range("B4").End(xlDown).Offset(-1, 0).End(xlToRight).Offset(0, -1))