![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Mar 2002
Posts: 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
|
|
|
|
|
|
#2 |
|
BatCoder
Join Date: Feb 2002
Location: Turkey
Posts: 764
|
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 |
|
|
|
|
|
#3 |
|
BatCoder
Join Date: Feb 2002
Location: Turkey
Posts: 764
|
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 ] |
|
|
|
|
|
#4 |
|
New Member
Join Date: Mar 2002
Posts: 11
|
Thanks a lot ...Suat
|
|
|
|
|
|
#5 |
|
BatCoder
Join Date: Feb 2002
Location: Turkey
Posts: 764
|
you're welcome Wichien.
suat |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|