Using vba to copy data to different worksheets using criteria

mr7jd

New Member
Joined
Mar 22, 2020
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
Hi all, got a big ask, been trying to figure it out but getting no where with it

I need to write some vba code that connects to a button, the criteria that i need to implement is as follows:

If value in col H > 0:

- Send cols G:H , AG:BL to one sheet (MANUFACTURE_LIST)

- Send cols AG:AJ, AK:AN, AO:AR, AV:AX, BA:BC, BD:BG, BH:BK to one sheet (CUTTING_LIST_MELAMINE) as a list, adding together the amounts with the same lengths and widths, sorting by largest size first.

- Send cols L,O:P & V,Y:Z to same sheet as above if cols M,W = "Melamine".

- Send cols L,O:P & V,Y:Z to one sheet (CUTTING_LIST_SUPAWOOD) if cols M,W = "Supawood", adding together amounts with same lengths and widths, sorting by largest size first.

- Send cols L,O:P & V,Y:Z to one sheet (CUTTING_LIST_VENEER) if cols M,W = "Veneer", adding together amounts with the same lengths and widths, sorting by largest size first.



i can provide a sharable link to the file if that would make it easier for you

here is the code that ive manage to make work so far

VBA Code:
Private Sub CommandButton1_Click() G = Worksheets("SPEC_SHEET").Cells(Rows.Count, 7).End(xlUp).Row For i = 2 To G         If Worksheets("SPEC_SHEET").Cells(i, 8).Value > 0 Then            Worksheets("SPEC_SHEET").Rows(i).Copy            Worksheets("Sheet1").Activate            h = Worksheets("Sheet1").Cells(Rows.Count, 7).End(xlUp).Row            Worksheets("Sheet1").Cells(h + 1, 1).Select            ActiveSheet.Paste            Worksheets("SPEC_SHEET").Activate         End If Next Application.CutCopyMode = False ThisWorkbook.Worksheets("SPEC_SHEET").Cells(1, 1).Select End Sub

Any help that anyone could provide would greatly appreciated. This spreadsheet has had me pulling my hair out to try and get it working efficiently (There are a lot of other worksheets hidden within this workbook that i have spent a lot of time on to get them right also)
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
I realize that this is an old post, but the sharable file would be best. I would love to help you futher.
 
Upvote 0

Forum statistics

Threads
1,214,854
Messages
6,121,941
Members
449,056
Latest member
denissimo

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