Macro for copying values (archive macro)

chobanne

Active Member
Joined
Jul 3, 2011
Messages
269
Hi all,

I want to make some archive macro in sheet 1, and i dont know how to do that.

In sheet 1 i am calculating something in random cells (example cell B1, B3, and B5). In Sheet 2 I want to make an archive in which i want to store values from sheet 1 in this order - B1 goes to A4, C3 goes to B4, D5 goes to C4. The coping procedure must be only values not formulas. Then If I calculate something else in sheet 1 and start macro again, new values from B1, B3 and B5 must be stored in cells A5, B5, and C5 in sheet 2. Each next click on the macro, values from sheet 1 would be copied in the first next new free row below the last data in sheet 2 in columns A, B and C

Can someone please help me on this
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Sorry i saw one mistake in mY post.
The order i wrote is not B1 goes to A4, C3 goes to B4, D5 goes to C4 yet B1 goes to A4, B3 goes to B4, B5 goes to C4
 
Upvote 0
VBA Code:
Option Explicit
Sub transfer()
Dim nextR&
'detect next row in sheet2
nextR = Worksheets("Sheet2").Range("A:C").Find(what:="*", searchorder:=xlByRows, searchdirection:=xlPrevious).Row + 1
'paste value
Worksheets("Sheet2").Cells(nextR, 1).Value = Worksheets("Sheet1").Range("B1").Value
Worksheets("Sheet2").Cells(nextR, 2).Value = Worksheets("Sheet1").Range("B3").Value
Worksheets("Sheet2").Cells(nextR, 3).Value = Worksheets("Sheet1").Range("B5").Value
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,215,444
Messages
6,124,893
Members
449,194
Latest member
JayEggleton

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top