Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


Copy fixed rows from one sheet and copy next row from other sheet on each click of command button


Copy fixed rows from one sheet and copy next row from other sheet on...

Author
Message
LadyAlina
LadyAlina
Forum God
Forum God (525 reputation)Forum God (525 reputation)Forum God (525 reputation)Forum God (525 reputation)Forum God (525 reputation)Forum God (525 reputation)Forum God (525 reputation)Forum God (525 reputation)Forum God (525 reputation)

Group: Forum Members
Posts: 1, Visits: 6
Hi,



What I'm trying to do is copy rows from sheet details one by one on each click however from sheet INV I want to copy fixed row. In the destination sheet it will add to next empty row each time I click on command button. But what my code does it it copys only fixed rows from details sheet. Can anybody help me please.



Private Sub CommandButton1_Click()

Application.ScreenUpdating = False

Dim ws1 As Worksheet, ws2 As Worksheet, ws3 As Worksheet

Dim DestRow As Long

Set ws1 = Sheets("Details")

Set ws2 = Sheets("Inv")

Set ws3 = Sheets("Reg")

DestRow = ws3.Cells(Rows.Count, "A").End(xlUp).Row + 1

ws1.Range("A4").copy ---------------------on next click it should copy A5 then A6

ws3.Range("A" & DestRow).PasteSpecial xlPasteValues

ws1.Range("B4").copy ---------------------on next click it should copy B5 then B6

ws3.Range("D" & DestRow).PasteSpecial xlPasteValues

ws1.Range("C4").copy ---------------------on next click it should copy C5 then C6

ws3.Range("G" & DestRow).PasteSpecial xlPasteValues

ws2.Range("B13").copy ---------------------this should be fixed rows for copying

ws3.Range("N" & DestRow).PasteSpecial xlPasteValues

ws2.Range("H13").copy ---------------------this should be fixed rows for copying

ws3.Range("L" & DestRow).PasteSpecial xlPasteValues

ws2.Range("I28").copy ---------------------this should be fixed rows for copying

ws3.Range("J" & DestRow).PasteSpecial xlPasteValues

ws2.Range("H15").copy ---------------------this should be fixed rows for copying

ws3.Range("K" & DestRow).PasteSpecial xlPasteValues

Application.ScreenUpdating = True

End Sub

GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search