LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
ChrisA
 
Posts: n/a
Default Refreshing a User Defined Function

To all:

On Sheet 1 of my workbook, I have a date in cell A1. In the next sheet, I
want the same date as the previous sheet plus seven days. When I copy the
latest sheet, I want it to reference the sheet located prior to it rather
than referencing the original sheet (Sheet 1). After copying 52 worksheets,
I want each of them to reference the sheet located just prior to each of the
sheets.

I found this User Defined Function posted here on this discussion site and
it works great except for one thing. If I change the original date on Sheet
1, the UDF does not automatically update. Is there a way that I could make
this happen???

Any help would be greatly appreciated.

ChrisA

Function PrevSheet(rg As Range)
'Enter =PrevSheet(B1) on sheet2 and you'll get B1 from sheet1.
n = Application.Caller.Parent.Index
If n = 1 Then
PrevSheet = CVErr(xlErrRef)
ElseIf TypeName(Sheets(n - 1)) = "Chart" Then
PrevSheet = CVErr(xlErrNA)
Else
PrevSheet = Sheets(n - 1).Range(rg.Address).Value
End If
End Function

 
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
About User Defined Functions linzhang426 Excel Worksheet Functions 4 October 17th 05 09:27 PM
Excel option to store trendline's coefficients in cells for use Miguel Saldana Charts and Charting in Excel 9 June 20th 05 08:45 PM
Web Services function call and data refreshing Jonathan Stone Excel Worksheet Functions 0 June 1st 05 02:43 AM
User defined charts- font size too small Bill B Charts and Charting in Excel 1 December 30th 04 06:23 PM
how to move user defined function Grant Excel Worksheet Functions 1 November 17th 04 06:38 PM


All times are GMT +1. The time now is 09:15 PM.

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"