Excel VBA Runtime scenarios 1004: Method 'Range' of object '_Global' scenarios when trying to copy data
I'm performance testing and I need some guidance on After trying multiple solutions online, I still can't figure this out... I'm working with a Runtime behavior 1004 when attempting to copy a range of cells in my Excel VBA code. The specific line that triggers the behavior is when I use the `Range.Copy` method. Hereโs the relevant portion of my code: ```vba Sub CopyData() Dim sourceSheet As Worksheet Dim destinationSheet As Worksheet Set sourceSheet = ThisWorkbook.Sheets("Source") Set destinationSheet = ThisWorkbook.Sheets("Destination") ' Attempt to copy a specific range sourceSheet.Range("A1:B10").Copy destinationSheet.Range("A1") End Sub ``` The behavior message states: "Method 'Range' of object '_Global' failed." I've verified that both sheets exist and that the range I'm trying to copy actually contains data. I've also tried to explicitly define the workbook like this: ```vba Set sourceSheet = Workbooks("MyWorkbook.xlsx").Sheets("Source") ``` However, this doesn't resolve the scenario. Iโm running this code in Excel 2019 on Windows 10, and Iโve checked that macros are enabled. The range Iโm trying to copy is within bounds and should be accessible. Iโve even tried using `Cells` instead to refer to the range, but the same behavior occurs: ```vba sourceSheet.Cells(1, 1).Resize(10, 2).Copy destinationSheet.Cells(1, 1) ``` Could there be an scenario with how the sheets are referenced, or is there something Iโm missing regarding the workbook state? Any insights would be appreciated! Any ideas what could be causing this? I'm working with Vba in a Docker container on Debian. Is there a simpler solution I'm overlooking? I'm using Vba latest in this project.