LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Power of Macros

You're gonna be pasting over the same cells each time--always a1, a4, a5, a8,
a10??

And how do you know when to advance to the next row???

Option Explicit
Sub testme()

Dim fWks As Worksheet
Dim tWks As Worksheet
Dim iRow As Long
Dim iCtr As Long
Dim fCols As Variant
Dim tAddr As Variant

Set fWks = Worksheets("Sheet1")
Set tWks = Worksheets("sheet2")

fCols = Array("a", "B", "d", "H", "k")
tAddr = Array("a1", "a4", "a5", "a8", "a10")

If UBound(fCols) < UBound(tAddr) Then
MsgBox "Design error!"
Exit Sub
End If

With fWks
.Activate
iRow = ActiveCell.Row 'how do you know which one to use?
For iCtr = LBound(fCols) To UBound(fCols)
fWks.Cells(iRow, fCols(iCtr)).Copy _
Destination:=tWks.Range(tAddr(iCtr))
Next iCtr
End With
End Sub





Mr_Flamenco wrote:

Thanx bro.. that was really helpful ;) and cooool thing

i have another problem

i have two difference sheets in excel.. and i need to copy some data
from the 2nd sheet to the 1st sheet.. the problem is.. the data i want
to copy are Row wise and i want to paste them Column.. and there are
not in one range.. i mean for example : A1 B1 D1 H1 K1 and i want to
paste them in A1 A4 A5 A8 A10

and each time i want to copy it should copy from the next row i.e A2 B2
D2 H2 K2 and paste them to the same column i.e A1 A4 A5 A8 A10

and all this is done thought a botton... i am not an excel or VB
programmer so i am facing some difficulties with it..

thank you in Advance

--
Mr_Flamenco
------------------------------------------------------------------------
Mr_Flamenco's Profile: http://www.excelforum.com/member.php...o&userid=29733
View this thread: http://www.excelforum.com/showthread...hreadid=494435


--

Dave Peterson
 
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
Power Fit - Trendline gsamoil Excel Discussion (Misc queries) 3 April 21st 23 06:08 PM
Ten to the power of six Corren New Users to Excel 9 April 14th 07 11:25 PM
Power and Sum John Watt Excel Worksheet Functions 6 January 4th 07 09:52 PM
Nth power dilemma Andre Croteau Excel Discussion (Misc queries) 6 June 23rd 06 09:16 PM
how to use power point sara benson Excel Discussion (Misc queries) 2 December 12th 05 03:50 PM


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