Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default Editing recorded macro code. Referencing workbook name in functio

I created the following code using the macro recorder. What I need to do is
find a way to replace the workbook name reference in the function with some
generic reference that will always look in the open workbook -- no matter
what the user names it.

I think I know how to do it, in terms of creating variables to reference the
workbook -- but I don't know how the syntax works in a worksheet function
like this.

Range("A64").Select
ActiveCell.FormulaR1C1 = _
"='[Functional Generic Estimating Model Loaded 1.1.xls]Summary
Data'!R[440]C20"
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default Editing recorded macro code. Referencing workbook name in functio

Hi Mark,

Not sure this will do exactly what you want, but you maybe able to play with
it and get what you want:
Sub Macro1()
Range("A64").Select
Z = ActiveWorkbook.Name
ActiveCell.FormulaR1C1 = _
"='[" & Z & "]SummaryData '!R[440]C20"
End Sub


"Mark" wrote:

I created the following code using the macro recorder. What I need to do is
find a way to replace the workbook name reference in the function with some
generic reference that will always look in the open workbook -- no matter
what the user names it.

I think I know how to do it, in terms of creating variables to reference the
workbook -- but I don't know how the syntax works in a worksheet function
like this.

Range("A64").Select
ActiveCell.FormulaR1C1 = _
"='[Functional Generic Estimating Model Loaded 1.1.xls]Summary
Data'!R[440]C20"

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default Editing recorded macro code. Referencing workbook name in fun

In all honesty, that is what I think I need. I just needed to know the
syntax for referencing the variable in the worksheet function in the macro.
Thanks.

"David" wrote:

Hi Mark,

Not sure this will do exactly what you want, but you maybe able to play with
it and get what you want:
Sub Macro1()
Range("A64").Select
Z = ActiveWorkbook.Name
ActiveCell.FormulaR1C1 = _
"='[" & Z & "]SummaryData '!R[440]C20"
End Sub


"Mark" wrote:

I created the following code using the macro recorder. What I need to do is
find a way to replace the workbook name reference in the function with some
generic reference that will always look in the open workbook -- no matter
what the user names it.

I think I know how to do it, in terms of creating variables to reference the
workbook -- but I don't know how the syntax works in a worksheet function
like this.

Range("A64").Select
ActiveCell.FormulaR1C1 = _
"='[Functional Generic Estimating Model Loaded 1.1.xls]Summary
Data'!R[440]C20"

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
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
Recorded macro Gaurav[_3_] Excel Discussion (Misc queries) 4 September 22nd 08 06:46 PM
looking to simplify a recorded macro with code HM Excel Programming 2 February 10th 04 06:35 PM
Recalculation Speed After Editing Macro Code Bob Keating Excel Programming 1 November 16th 03 01:08 PM
Protect macro code from viewing/editing Keith[_8_] Excel Programming 5 October 30th 03 02:59 PM


All times are GMT +1. The time now is 12:02 AM.

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

About Us

"It's about Microsoft Excel"