ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   copy back macro/roll back (https://www.excelbanter.com/excel-worksheet-functions/132870-copy-back-macro-roll-back.html)

Moh

copy back macro/roll back
 
Hi,

I have two tabs within one workbook. One is called 'current tab' second one
is called 'previous tab'.

I am trying to create a macro in the current tab that will delete all values
within the 'previous tab' and replace it with the values from the 'current
tab'. In other words, the values in the 'current tab' is moved to 'previous
tab'.

Can anyone help?

Thanks

Mike

copy back macro/roll back
 
This will do it but you should be aware that all the contents of previous tab
will be overwritten and lost.

Sub Copyonetoanother()
Sheets("Previous Tab").Select
Cells.Select
Selection.ClearContents
Sheets("Current Tab").Select
Cells.Select
Selection.Copy
Sheets("Previous Tab").Select
ActiveSheet.Paste
End Sub

"moh" wrote:

Hi,

I have two tabs within one workbook. One is called 'current tab' second one
is called 'previous tab'.

I am trying to create a macro in the current tab that will delete all values
within the 'previous tab' and replace it with the values from the 'current
tab'. In other words, the values in the 'current tab' is moved to 'previous
tab'.

Can anyone help?

Thanks


Gord Dibben

copy back macro/roll back
 
"All" values..........?

Record yourself deleting "previous" sheet and making a copy of "current" sheet.


Gord Dibben MS Excel MVP

On Thu, 1 Mar 2007 02:50:00 -0800, moh wrote:

Hi,

I have two tabs within one workbook. One is called 'current tab' second one
is called 'previous tab'.

I am trying to create a macro in the current tab that will delete all values
within the 'previous tab' and replace it with the values from the 'current
tab'. In other words, the values in the 'current tab' is moved to 'previous
tab'.

Can anyone help?

Thanks



Moh

copy back macro/roll back
 
Hi Mike,

Thanks for taking the time out to solve the issue. However I have one more
issue, I wounder if you can help.

Both previous and current tabs have data according to months. Now I would
like to modify a fixed range and set paramaters so that everytime you press
roll back macro the next month (new column) appears in the worksheet
automatically.

This is an extract of the cuurent range macro:
Range("M6:AB68").Select

I would like to somehow change the range "AB68" and set a parameter, so that
everytime you press roll back, the next month (a new column) appears
automatically.

For example, I have months Jan 07, Feb 07, Mar 07. Now when I click the roll
back macro, obviously al data will dissapear to previous tab overwriting
other data. At the same time I would like the macro to show a new column
(April 07) automatically.

Could you please help me setup this parameter?

Many Thanks,
Moh

"Mike" wrote:

This will do it but you should be aware that all the contents of previous tab
will be overwritten and lost.

Sub Copyonetoanother()
Sheets("Previous Tab").Select
Cells.Select
Selection.ClearContents
Sheets("Current Tab").Select
Cells.Select
Selection.Copy
Sheets("Previous Tab").Select
ActiveSheet.Paste
End Sub

"moh" wrote:

Hi,

I have two tabs within one workbook. One is called 'current tab' second one
is called 'previous tab'.

I am trying to create a macro in the current tab that will delete all values
within the 'previous tab' and replace it with the values from the 'current
tab'. In other words, the values in the 'current tab' is moved to 'previous
tab'.

Can anyone help?

Thanks


Moh

copy back macro/roll back
 
Hi,

Thanks for taking the time out to solve the issue. However I have one more
issue, I wounder if you can help.

Both previous and current tabs have data according to months. Jan - Dec 07.
Now I would like to modify a fixed range and set paramaters on the macro so
that everytime you press
roll back macro ,the next month (new column) appears in the worksheet
automatically as well as pasting the new information on previous tab.

This is an extract of the current range macro: this is fixed but I need to
change it to set a parameter.
Range("M6:AB68").Select .

For example, you can assume M6 is Jan 07, M7 is Feb 07, and AB is Dec 07.
Now when I click the roll
back macro, obviously al data will dissapear to previous tab overwriting
other data. At the same time I would like the macro to show a new column
(Jan 08) automatically.

I would like to somehow show me how to change the fixed range "AB68" and set
a parameter, so that
everytime you press roll back, the next month (a new column) appears
automatically in order to dates.



Could you please help me setup this parameter?

Many Thanks,
Moh

"Gord Dibben" wrote:

"All" values..........?

Record yourself deleting "previous" sheet and making a copy of "current" sheet.


Gord Dibben MS Excel MVP

On Thu, 1 Mar 2007 02:50:00 -0800, moh wrote:

Hi,

I have two tabs within one workbook. One is called 'current tab' second one
is called 'previous tab'.

I am trying to create a macro in the current tab that will delete all values
within the 'previous tab' and replace it with the values from the 'current
tab'. In other words, the values in the 'current tab' is moved to 'previous
tab'.

Can anyone help?

Thanks





All times are GMT +1. The time now is 07:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com