View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default 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