Copy Rows based on cell value to match with tab name

Apple08

Active Member
Joined
Nov 1, 2014
Messages
403
Hi All

I need to copy the row data from "Sheet 8" to "Sheet 1", "Sheet 2", "Sheet 3", "Sheet 4" and "Sheet 5" based on the column A cell value of "Sheet 8". If the cell value is matched with the tab name, e.g. Sheet 1, then the whole row of content will be copied to the worksheet "Sheet 1" from row 2 as there is a header row for all worksheets. The number of rows in "Sheet 8" is unknown.

I wonder is anyone able to help. Many thanks.
 

Apple08

Active Member
Joined
Nov 1, 2014
Messages
403
Try this:
Run this script from the sheet named "Sup Tracker" with your sheet names in column A
I assume you have a header row in sheet named "Sup Tracker" so search starts in row(2)

VBA Code:
Sub Filter_Me_Please_Array()
'Modified  4/14/2021  6:30:25 AM  EDT
Dim Del As Variant
Del = Array("STEM", "FASS", "WELS", "PVC-S", "FBL") ' Modify Sheet names if needed
Dim lastrow As Long
Dim ans As Long
ans = UBound(Del)
Dim c As Long
Dim counter As Long
counter = 0
c = "1" ' Column Number Modify this to your need
lastrow = Cells(Rows.Count, c).End(xlUp).Row

With Sheets("SUP Tracker").Cells(1, c).Resize(lastrow)

For i = 0 To ans
    .AutoFilter 1, Del(i), Operator:=xlFilterValues
    counter = .Columns(c).SpecialCells(xlCellTypeVisible).Count
    If counter > 1 Then .Offset(1).Resize(.Rows.Count - 1).SpecialCells(xlCellTypeVisible).EntireRow.Copy Sheets(Del(i)).Cells(2, 1)
counter = 0
Next
.AutoFilter
End With
End Sub
Wow it works like a magic! I really appreciate your help very much! Thank you for spending your time and effort to help me. You are a star! :)
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
17,554
Office Version
  1. 2013
Platform
  1. Windows
Wow it works like a magic! I really appreciate your help very much! Thank you for spending your time and effort to help me. You are a star! :)
Glad I was able to help you.
Come back here to Mr. Excel next time you need additional assistance.
 

Watch MrExcel Video

Forum statistics

Threads
1,129,270
Messages
5,635,203
Members
416,846
Latest member
ImGoing2needaFormula

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
Top