It seems I have worked on this bit of code for months and it was working until the sheet that the data is coming from was changed. To allow for this and any further possible changes I did the following.
So just to clarify what is going on here. An external workbook is being opened with the variable "Fnm" Once this is open I need to declare the row where the data will be, and pass it to the next line to set the next variable "CopRan" It is always in Column "S".
This all works if I don't try and do this ie drop the red line and have an actual number instead of the variable.
I have Dim'd the variables at the beginning of the code.
If I put this line in the immeadiate window on the target sheet I do get the result I require.
I get the Error "Object Required" Run time Error 424
Thanks Partjob
Code:
Workbooks.Open Filename:=Fnm 'place file path of workbook in cell in column A
With ActiveWorkbook
[COLOR=red]Rnum = Sheet43.Range("S" & Rows.Count).End(xlUp).Row
[/COLOR] CopRan = Range(Range("S" & Rnum), Range("S" & Rnum).Offset(0, Prolen)).Address
'find Range for copy
Sheets("Outline Activity Schedule").Range(CopRan).Copy
Workbooks(MyWbk).Sheets("Prediction").Cells(Target.Row, Pastecol).PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
This all works if I don't try and do this ie drop the red line and have an actual number instead of the variable.
I have Dim'd the variables at the beginning of the code.
If I put this line in the immeadiate window on the target sheet I do get the result I require.
I get the Error "Object Required" Run time Error 424
Thanks Partjob