Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default my workbook reference is not working

Hi
not tested but try:
"=LOOKUP(df,'[Trend source.xls]Stats!R1C4:R34C4,
[Trend source.xls]Stats'!R1C5:R34C5)"


"Papa Jonah" wrote:

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 148
Default my workbook reference is not working

Are you saying that all of the syntax can be combined, or is not needed at all?



"Don Guillett" wrote:

Could it be Trending Source vs Trend Source?

It appears that you are referring to:
a workbook named Trend Source
a worksheet named Stats

BTW you don't need all this selecting
Worksheets("Data (altered)").Range("F14").FormulaR1C1 = _
"=LOOKUP(df,[Trend source.xls]Stats!R1C4:R34C4, [Trend
source.xls]Stats!R1C5:R34C5)"



--
Don Guillett
SalesAid Software

"Papa Jonah" wrote in message
...
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




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 148
Default my workbook reference is not working

Frank,
I don't know why, but the ' seems to be the keey although I needed to add a
couple more. I needed one between the first "Stats" and "!" as well as
before the second "[Trend source"


thanks


"Frank Kabel" wrote:

Hi
not tested but try:
"=LOOKUP(df,'[Trend source.xls]Stats!R1C4:R34C4,
[Trend source.xls]Stats'!R1C5:R34C5)"


"Papa Jonah" wrote:

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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default my workbook reference is not working

I'm saying that when you get your ' 's properly set for the spacing in
the names, that you can make it a ONE liner as I did.

--
Don Guillett
SalesAid Software

"Papa Jonah" wrote in message
...
Are you saying that all of the syntax can be combined, or is not needed at

all?



"Don Guillett" wrote:

Could it be Trending Source vs Trend Source?

It appears that you are referring to:
a workbook named Trend Source
a worksheet named Stats

BTW you don't need all this selecting
Worksheets("Data (altered)").Range("F14").FormulaR1C1 = _
"=LOOKUP(df,[Trend source.xls]Stats!R1C4:R34C4, [Trend
source.xls]Stats!R1C5:R34C5)"



--
Don Guillett
SalesAid Software

"Papa Jonah" wrote in message
...
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






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Absolute Reference not working Iriemon Excel Worksheet Functions 3 February 3rd 09 05:05 PM
External reference not working Todd Lietha[_2_] Excel Worksheet Functions 1 September 22nd 07 05:24 AM
External reference not working? Todd Lietha Excel Discussion (Misc queries) 5 September 21st 07 09:36 PM
Sheet Reference is not working Kevin Excel Worksheet Functions 2 November 10th 06 03:57 PM
workbook linking cells not working within a workbook martyn Excel Discussion (Misc queries) 1 November 3rd 06 12:11 PM


All times are GMT +1. The time now is 09:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"