VBA to Copy and Paste Rows if Condition

plastakis

New Member
Joined
Apr 10, 2019
Messages
23
Hi,

I need prepare offer form. In Sheet 2 i have database with all products and full information about them in row. In sheet1 i have offer(proposal) form. So i trying to make such form, that you can select specific product in Sheet 2 using checkbox and that product with full information which arein same row automatic export in proposal form (under 17 row). Please help me because i searched, but haven't found...
 
Thanks a lot this code works great!! I have one question is it possible to upgrade this code that when copy data to Skaiciavimai sheet stays Skaiciavimai sheet format, like table lines and format? because right now i just get blank cell in paste area.
 
Upvote 0

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Thanks one more time for your help!! I am very grateful for both codes! And i have final question is it possible copy from "Agregatu lentele" to "Skaiciavimai" just values ? Because right now copy all formulas..
 
Upvote 0
In post 11 you say you want to paste everything.
In post 12 you say you want to only paste values.
So what is it??
 
Upvote 0
Try this:


Code:
Sub Button5_Click()
'Modified  4/23/2019  9:22:50 AM  EDT
Dim a As Long
Dim b As Long
a = Worksheets("Agregatu lentele").Cells(Rows.Count, 2).End(xlUp).Row
b = Worksheets("SKAICIAVIMAI").Cells(Rows.Count, 1).End(xlUp).Row
    For i = 2 To a
        If Sheets("Agregatu lentele").Cells(i, 2).Value = True Then
            Sheets("Agregatu lentele").Cells(i, 1).Resize(, 5).Copy
            Sheets("SKAICIAVIMAI").Cells(b, 1).PasteSpecial xlPasteValues
            b = b + 1
        End If
    Next
Application.CutCopyMode = False
Application.Goto ThisWorkbook.Worksheets("Agregatu lentele").Cells(1, 1)
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,711
Messages
6,174,029
Members
452,542
Latest member
Bricklin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top