Coping to multiple sheets

Workathome

New Member
Joined
May 2, 2022
Messages
2
Office Version
  1. 2016
Platform
  1. Windows
Hey

I have an excel sheet with data on it that looks like this: All the data is in this order and opened from an exported csv.

A3 B3 C3 D3 E3 F3 g3 H3
1658340588306.png


Under the "company" I have 15 companies with different acronyms (ABC, DEF, GHI etc etc)

I have sheet tabs below with the company acronym labels (ABC, DEF, GHI etc etc) on the same workbook.

I need to have the data auto copied to the proper sheet and then sorted to this format below. As you can see the titles are somewhat in the same order.
Some are not however.

1658340252448.png



I created a module (see below) but it is not working and I can not figure out why.


Sub CopyOverbycompanyABC ()


Dim Company As Range
Dim Status As Range
Dim PasteCell As Range

Set Company = Sheet1.Range("A4:A20541")

For Each Status In Company

If Sheet2.Range("F2") = "" Then
Set PasteCell = Sheet2.Range("A2")
Else
Set PasteCell = Sheet2.Range("A1").End(xlDown).Offset(1, 0)
End If

If Status = "BWH" Then Status.Offset(0, -4).Resize(1, 5).Copy PasteCell

Next Status

End Sub


Any assistance would be greatly appriciated.

Thank you

Eric
 

Attachments

  • 1658339965297.png
    1658339965297.png
    3.9 KB · Views: 5

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Forum statistics

Threads
1,214,788
Messages
6,121,603
Members
449,038
Latest member
Arbind kumar

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