View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Papa Jonah Papa Jonah is offline
external usenet poster
 
Posts: 148
Default my workbook reference is not working

I have a workbook that uses a macro to copy itself, save it to another file,
then populates sheets with formulas and such. Everything works great until a
look up statement.
Below, I have pasted the troubling code in the macro. The referenced sheet,
"Trending Source" is the original workbook that was copied and is still open.


Dim myrange As Range
Dim mysheet As Worksheet

Worksheets("Data (altered)").Select
Range("F14").Select
' Set myrange = Range("f14")
' Set mysheet = Worksheets("Data (altered)")

Range("F14").Select


'run time error 1004 occurs in following statement
ActiveCell.FormulaR1C1 = _
"=LOOKUP(df,[Trend source.xls]Stats!R1C4:R34C4,
[Trend source.xls]Stats!R1C5:R34C5)"

Range("F15").Select . . .

Any ideas? TIA