Home > Software engineering >  VBA and ChatGPT - When trying to Copy an Array row to a worksheet I keep getting Error 424
VBA and ChatGPT - When trying to Copy an Array row to a worksheet I keep getting Error 424

Time:01-27

Any help would be much appreciated, I've been trying to fix this for 2 days now with ChatGPT.

When I try to Copy a row of data from an Array to a worksheet I keep getting Error 424.

See code below - it's not the full set of code, but I get the error on the last line.

'closedArrayRow.Copy Destination:=Worksheets("Sheet1").Range("A1")'

Option Explicit

Sub ArrayCopyTEST()

    
    Dim closedArray As Variant ' variable for closed sheet data

    
    'Store the data from the "Closed" worksheet into the array
    closedArray = Worksheets("Closed").UsedRange.Value
    
    
    closedArray.Copy Destination:=Worksheets("Sheet1").Range("A1"). '<<<<<<<<Error 424 Here
    
    End Sub  

I've tried a lot of different things but nothing is working, I'm very new to VBA and am using ChatGPT for help but I am stuck now.

CodePudding user response:

Try the following . . .

Worksheets("Sheet1").Range("A1").Resize(UBound(closedArray, 1), UBound(closedArray, 2)).Value = closedArray
  • Related