Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy Sheet Formula Reference


I have a stumper that I have searched this forum for, but to no avail.
I have code that copies an existing sheet and renames that sheet based
upon a value in a cell. I then have another sheet that needs to have a
MAX formula generated based upon the values of the sheet I just renamed.
What VBA code do I use so that the MAX formula references the newly
named sheet?

Here is what I have tried:


Sheets("Sheet1").Select
Sheets("Sheet1").Copy Befo=Sheets(1)
Sheets("Sheet1 (2)").Select
ActiveSheet.Name = ActiveSheet.Range("A1")
Dim shtName As String
Range("B2").Select
ActiveCell.FormulaR1C1 = "=MAX(String!RC[-11]:R[94]C[-11])"

I need that max formula to change based upon the generated sheet name,
help!!!

Thanks,

NicB.


--
NicB.
------------------------------------------------------------------------
NicB.'s Profile: http://www.excelforum.com/member.php...o&userid=20639
View this thread: http://www.excelforum.com/showthread...hreadid=497199

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Copy Sheet Formula Reference

Sheets("Sheet1").Select
Sheets("Sheet1").Copy Befo=Sheets(1)
Sheets("Sheet1 (2)").Select
ActiveSheet.Name = ActiveSheet.Range("A1")
Dim shtName As String
shtName = ActiveSheet.Name
Range("B2").Select
ActiveCell.FormulaR1C1 = "=MAX('" & ShtName & _
"'!RC[-11]:R[94]C[-11])"

But based on the fact that your code shows the formula on the same sheet as
the range being looked at, you don't need a sheet name.

Also, if you are putting the formula in B2, then using a relative reference
of -11 columns shouldn't work.

--
Regards,
Tom Ogilvy


"NicB." wrote in
message ...

I have a stumper that I have searched this forum for, but to no avail.
I have code that copies an existing sheet and renames that sheet based
upon a value in a cell. I then have another sheet that needs to have a
MAX formula generated based upon the values of the sheet I just renamed.
What VBA code do I use so that the MAX formula references the newly
named sheet?

Here is what I have tried:


Sheets("Sheet1").Select
Sheets("Sheet1").Copy Befo=Sheets(1)
Sheets("Sheet1 (2)").Select
ActiveSheet.Name = ActiveSheet.Range("A1")
Dim shtName As String
Range("B2").Select
ActiveCell.FormulaR1C1 = "=MAX(String!RC[-11]:R[94]C[-11])"

I need that max formula to change based upon the generated sheet name,
help!!!

Thanks,

NicB.


--
NicB.
------------------------------------------------------------------------
NicB.'s Profile:

http://www.excelforum.com/member.php...o&userid=20639
View this thread: http://www.excelforum.com/showthread...hreadid=497199



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
Copy Sheet #'s, but leave cell reference KennyD Excel Discussion (Misc queries) 3 November 9th 09 10:55 PM
Copy rows to new sheet based cell reference, not value michaelberrier Excel Discussion (Misc queries) 2 December 27th 06 12:24 AM
Copy a relative reference formula from one sheet to another. jannkatt Excel Discussion (Misc queries) 3 May 17th 06 07:13 PM
in VBA Sheets("mysheet").Copy Befo=Sheets(1) how do i get a reference to the newly created copy of this sheet? Daniel Excel Worksheet Functions 1 July 6th 05 09:57 PM
how do i copy a formula with different cell reference? wisonn Excel Programming 1 August 20th 04 01:14 PM


All times are GMT +1. The time now is 09:22 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"