LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
KDJ KDJ is offline
external usenet poster
 
Posts: 19
Default Reference the previous Worksheet in a Formula

Thank you to both of you.
KDJ

"Jacob Skaria" wrote:

Try

For x = 2 To TotalSheet
Sheets(x).Range("A5").FormulaR1C1 = "=" & Sheets(x - 1).Name & "!RC+2"
Next x

--
Jacob


"KDJ" wrote:

Hello
The following code is supposed to always reference the same cell in the
previous worksheet. Unfortunately, I can't figure out the sheet name with the
index number for the previous sheet. The line

ActiveCell.FormulaR1C1 = "=Sheets(x-1)!RC+2"

doesn't work.

Any suggestions?

Dim WeekStep As Integer
Dim TotalSheets As Integer
Dim x As Integer

WeekStep = InputBox("Number of weeks per worksheet:")
TotalSheets = InputBox("Number of Worksheets:")

For x = 2 To TotalSheets
Sheets(x).Select
Range("A5").Select
ActiveCell.FormulaR1C1 = "=Sheets(x-1)!RC+2"
Next x
--
Thanks very much. KDJ

 
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
Reference previous worksheet within VLOOKUP Alex Mackenzie Excel Worksheet Functions 2 April 17th 09 07:20 PM
formula to reference cell on previous worksheet endless_thoughts17 Excel Worksheet Functions 2 January 25th 08 07:37 PM
need formula to reference a cell in previous worksheet Jim Excel Worksheet Functions 3 January 5th 07 04:05 AM
How to reference to the previous worksheet regardless of title? SeabeePlumber Excel Worksheet Functions 0 July 15th 05 11:05 AM
reference to previous worksheet Daniel Lidström Excel Programming 2 December 16th 03 07:34 PM


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