Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default worksheet plus one

I am trying to build a monthly worksheet that imports data from cells on
adjacent worksheets. Right now, I copy the worksheet, then have to manually
type in ('August 06'!G2,'Sept 06'!G2,'Oct 06'!G2). What I would like to do
is set it up so that it will take the current month G2, then add 1 and
subtract 1 to get the adjacent month's data so that it always shows a
rolling three month.

I've not been able to find a function that allows "worksheet+1"
"worksheet-1". Is this possible?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default worksheet plus one

Sub getthreemonths()
pws = Sheets(ActiveSheet.Index - 1).Range("g2")
nws = Sheets(ActiveSheet.Index + 1).Range("g2")
MsgBox pws + Range("g2") + nws
End Sub

or put the below into a regular module in your workbook.
Function gtm()'just type =gtm() on the active sheet
pws = Sheets(ActiveSheet.Index - 1).Range("g2")
nws = Sheets(ActiveSheet.Index + 1).Range("g2")
gtm = pws + Range("g2") + nws
End Function

--
Don Guillett
SalesAid Software

"Brock Angelo" wrote in message
. ..
I am trying to build a monthly worksheet that imports data from cells on
adjacent worksheets. Right now, I copy the worksheet, then have to
manually
type in ('August 06'!G2,'Sept 06'!G2,'Oct 06'!G2). What I would like to do
is set it up so that it will take the current month G2, then add 1 and
subtract 1 to get the adjacent month's data so that it always shows a
rolling three month.

I've not been able to find a function that allows "worksheet+1"
"worksheet-1". Is this possible?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default worksheet plus one

Previous Month:

=INDIRECT("'" &TEXT(DATE(YEAR(TODAY()),MONTH(TODAY())-1,DAY(TODAY())),"mmmm
yy") & "'!G2")

Current Month
=INDIRECT("'" &TEXT(DATE(YEAR(TODAY()),MONTH(TODAY()),DAY(TODAY( ))),"mmmm
yy") & "'!G2")

Next Month
=INDIRECT("'" &TEXT(DATE(YEAR(TODAY()),MONTH(TODAY())+1,DAY(TODA Y())),"mmmm
yy") & "'!G2")

--
Regards,
Tom Ogilvy


"Brock Angelo" wrote:

I am trying to build a monthly worksheet that imports data from cells on
adjacent worksheets. Right now, I copy the worksheet, then have to manually
type in ('August 06'!G2,'Sept 06'!G2,'Oct 06'!G2). What I would like to do
is set it up so that it will take the current month G2, then add 1 and
subtract 1 to get the adjacent month's data so that it always shows a
rolling three month.

I've not been able to find a function that allows "worksheet+1"
"worksheet-1". Is this possible?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default worksheet plus one

In each formula, change Day(today()) to the number 1 to avoid end of month
problems.

--
Regards,
Tom Ogilvy


"Brock Angelo" wrote:

I am trying to build a monthly worksheet that imports data from cells on
adjacent worksheets. Right now, I copy the worksheet, then have to manually
type in ('August 06'!G2,'Sept 06'!G2,'Oct 06'!G2). What I would like to do
is set it up so that it will take the current month G2, then add 1 and
subtract 1 to get the adjacent month's data so that it always shows a
rolling three month.

I've not been able to find a function that allows "worksheet+1"
"worksheet-1". Is this possible?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default worksheet plus one

After closer reading of the question:

Previous Month:

=INDIRECT("'" &TEXT(DATE(YEAR(G2),MONTH(G2)-1,1),"mmmm yy") & "'!G2")



Next Month
=INDIRECT("'" &TEXT(DATE(YEAR(G2),MONTH(G2)+1,1),"mmmm yy") & "'!G2")

Format the cells as Date.



--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote:

Previous Month:

=INDIRECT("'" &TEXT(DATE(YEAR(TODAY()),MONTH(TODAY())-1,DAY(TODAY())),"mmmm
yy") & "'!G2")

Current Month
=INDIRECT("'" &TEXT(DATE(YEAR(TODAY()),MONTH(TODAY()),DAY(TODAY( ))),"mmmm
yy") & "'!G2")

Next Month
=INDIRECT("'" &TEXT(DATE(YEAR(TODAY()),MONTH(TODAY())+1,DAY(TODA Y())),"mmmm
yy") & "'!G2")

--
Regards,
Tom Ogilvy


"Brock Angelo" wrote:

I am trying to build a monthly worksheet that imports data from cells on
adjacent worksheets. Right now, I copy the worksheet, then have to manually
type in ('August 06'!G2,'Sept 06'!G2,'Oct 06'!G2). What I would like to do
is set it up so that it will take the current month G2, then add 1 and
subtract 1 to get the adjacent month's data so that it always shows a
rolling three month.

I've not been able to find a function that allows "worksheet+1"
"worksheet-1". Is this possible?

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
automatically appending newly added data on worksheet to a master list worksheet tabylee via OfficeKB.com Links and Linking in Excel 0 December 17th 09 04:24 PM
plot graph from multiple worksheet as embedded chart object on every worksheet [email protected] Charts and Charting in Excel 3 August 24th 06 07:26 PM
plot graph from multiple worksheet as embedded chart object on every worksheet [email protected] Excel Discussion (Misc queries) 2 August 24th 06 05:26 PM
Upload multiple text files into 1 excel worksheet + put the filename as the first column in the worksheet Aster Excel Worksheet Functions 3 March 12th 06 09:58 AM
Attaching a JET database to an Excel Worksheet OR storing large binary data in a worksheet Ant Waters Excel Programming 1 September 3rd 03 11:34 AM


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