Copy data and Paste

wichien

New Member
Joined
Mar 14, 2002
Messages
11
I have data in Sheet1 Range A1 ,C1,D1,H1 ,and I want copy that Cells to Sheet2 Range E1,F1,H1,Z1 by Sequently (I mean A1 -> E1 ,C1->F1 ......and use For ...next Command .Thanks
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Try something like this:


Private Sub Transfer()
Dim a(4, 2) As Integer
a(1, 1) = 1: a(1, 2) = 5
a(2, 1) = 3: a(2, 2) = 6
a(3, 1) = 4: a(3, 2) = 8
a(4, 1) = 8: a(4, 2) = 26


For i = 1 To 4
Sheet2.Cells(1, a(i, 2)).Value = Sheet1.Cells(1, a(i, 1)).Value
Next i
End Sub


hope this helps
suat
 
Upvote 0
sorry, "a" array keeps column numbers as you can see. second paramater stands for sheet number and first parameter is column reference as integer.

a(x, 1) means Sheet1's x. column
a(x, 2) means Sheet2's x. column

suat
This message was edited by smozgur on 2002-03-15 09:48
This message was edited by smozgur on 2002-03-15 09:48
This message was edited by smozgur on 2002-03-15 09:48
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,492
Members
448,967
Latest member
visheshkotha

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