Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm writing a run of the mil VBA Sub that iterates through one
worksheet and copies selected rows in another sheet. The row has 20 columns of data. If Dim i as Integer Dim j as Integer Dim s1 as Worksheet Dim s2 as Worksheet Dim b as Workbook set b = ActiveWorkbook set s1 = b.Sheets(1) set s2 = b.Sheets(2) i = 3 j = 7 ' Most efficent code to copy 20 columns of data from s1.Rows(i) to s2.Rows(j) ' I'd prefer not to have a For loop that iterates through 20 cells for each row. Thanks. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
s1.Cells(i,"A").Resize(1,20).Copy s2.Cells(j,"A")
change the "A" in each part to suit. -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) wrote in message oups.com... I'm writing a run of the mil VBA Sub that iterates through one worksheet and copies selected rows in another sheet. The row has 20 columns of data. If Dim i as Integer Dim j as Integer Dim s1 as Worksheet Dim s2 as Worksheet Dim b as Workbook set b = ActiveWorkbook set s1 = b.Sheets(1) set s2 = b.Sheets(2) i = 3 j = 7 ' Most efficent code to copy 20 columns of data from s1.Rows(i) to s2.Rows(j) ' I'd prefer not to have a For loop that iterates through 20 cells for each row. Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VB code to copy sheet format to another sheet | Excel Discussion (Misc queries) | |||
How do i copy a active sheet to a new sheet with code and everything | Excel Programming | |||
efficent find all and value | Excel Programming | |||
Copy sheet without Code | Excel Programming | |||
Copy Sheet w/o VBA code | Excel Programming |