I am trying to define where data copied from one worksheet should be placed on another. I am able to set all other variables except this one. The variable is dimensioned only in the sub where it is located. As I F8 through the sub I get a Runtime error 1004;: Method ‘Range of Object’_Global failed.
The code below is my attempt to set my variables. The Set rngDestin is where the error occurs.
No clue what to look for a or where to start. Can someone suggest possible cause of error?
Previous help from this forum seem to fix the problem. But it didn't. I was told to change the last statement to:
Set rngDestin = Worksheets("Prepared_Expense").Range("R6")
This did not work. Thread 707-797295 was the orginal request for help and the two responses I got.
Sub MatchPCA()
'
' MatchPCA Macro
' Macro recorded 2/20/2004 by Robert S. Johnson
Dim intCounter As Integer, intStop As Integer
Dim rngGMPCA As Range, rngDAFRPCA As Range, rngDestin As Range, rngToCopy As Range
'This initializes the variable for the first match.
Set rngDAFRPCA = Range(Worksheets("Prepared_Expense").Range("Q6").Offset(1, -15))
Set rngGMPCA = Range(Worksheets("First QT").Range("B4")) 'Change to variable!
Set rngToCopy = Worksheets("First QT").Range("CB5:CE5") 'Change to variable!
Set rngDestin = Range(Worksheets("Prepared_Expense").Range("R6"))
The code below is my attempt to set my variables. The Set rngDestin is where the error occurs.
No clue what to look for a or where to start. Can someone suggest possible cause of error?
Previous help from this forum seem to fix the problem. But it didn't. I was told to change the last statement to:
Set rngDestin = Worksheets("Prepared_Expense").Range("R6")
This did not work. Thread 707-797295 was the orginal request for help and the two responses I got.
Sub MatchPCA()
'
' MatchPCA Macro
' Macro recorded 2/20/2004 by Robert S. Johnson
Dim intCounter As Integer, intStop As Integer
Dim rngGMPCA As Range, rngDAFRPCA As Range, rngDestin As Range, rngToCopy As Range
'This initializes the variable for the first match.
Set rngDAFRPCA = Range(Worksheets("Prepared_Expense").Range("Q6").Offset(1, -15))
Set rngGMPCA = Range(Worksheets("First QT").Range("B4")) 'Change to variable!
Set rngToCopy = Worksheets("First QT").Range("CB5:CE5") 'Change to variable!
Set rngDestin = Range(Worksheets("Prepared_Expense").Range("R6"))