Hi! I'm sorry for any trouble, but I am getting a horrible runtime error that I can't figure out. The error is "Run-time error '1004': Activate method of Range class failed." I've pasted some of my code below. I have two workbooks open - one containing the macro code, and the other containing the data and both worksheets ("C21004," where the data comes from, and "Discrepancies," where I want it to go). The code works beautifully until I want to output it on another worksheet. I've been able to output the array to a MsgBox so I know it has the data stored successfully. I've checked my spelling, tried renaming the worksheet, tried using "Select" instead of "Activate," and tried first activating the workbook. Nothing helps! I've done very similar code before, so I don't understand what the problem is. Help would be AWESOME. Thank you!!
Sheets("C21004").Range("D3").Select
For i = 0 To x
If IsEmpty(ActiveCell) = False Then
' ...a lot of code which basically writes data from sheet "C21004" to a two-dimensional array...
Else: GoTo Display:
End If
Next i
'Here I'm trying to output the array into a table on a separate worksheet called "Discrepancies"
Display:
Sheets("Discrepancies").Range("A4").Activate 'This is where I get the error
ActiveCell.Value = a(0, 1)
ActiveCell.Offset(0, 1).Value = a(0, 2)
Sheets("C21004").Range("D3").Select
For i = 0 To x
If IsEmpty(ActiveCell) = False Then
' ...a lot of code which basically writes data from sheet "C21004" to a two-dimensional array...
Else: GoTo Display:
End If
Next i
'Here I'm trying to output the array into a table on a separate worksheet called "Discrepancies"
Display:
Sheets("Discrepancies").Range("A4").Activate 'This is where I get the error
ActiveCell.Value = a(0, 1)
ActiveCell.Offset(0, 1).Value = a(0, 2)