Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
copy rows to sheet 2
Hello,
I am new to (VBA) programming so my question is most likely fairly simple. In my table cell B3 contains the row number that it is all about, I would like the row indicated in cell B3 and the row before that copied to sheet2 (so if B3 = 43 I would like to have row 42 and 43 copied to sheet 2). On sheet2 these two rows should be placed on row 2 and 3 starting at column A. Hope my question is clear, if not please ask me for further information. Barry |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
copy rows to sheet 2
Sub copydata()
Dim rw as Long rw = Range("B3").Value - 1 if rw 0 and rw < 65536 then rows(rw).Resize(2).copy worksheets("Sheet2").Rows(2).PasteSpecial xlValues end if End Sub change xlValues to xlAll if you want all formatting and formulas. -- Regards, Tom Ogilvy "GBvdH" wrote: Hello, I am new to (VBA) programming so my question is most likely fairly simple. In my table cell B3 contains the row number that it is all about, I would like the row indicated in cell B3 and the row before that copied to sheet2 (so if B3 = 43 I would like to have row 42 and 43 copied to sheet 2). On sheet2 these two rows should be placed on row 2 and 3 starting at column A. Hope my question is clear, if not please ask me for further information. Barry |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
copy rows from one Data sheet to another sheet based on cell conte | Excel Discussion (Misc queries) | |||
copy matching value rows to other sheet | Excel Discussion (Misc queries) | |||
copy rows to other sheet | Excel Worksheet Functions | |||
Search for rows in one sheet and copy into another sheet based on customer id | Excel Worksheet Functions | |||
Select rows and copy to another sheet. | Excel Programming |