VBA Loop Through Range and Copy/Paste to Another Sheet

BrandonL

New Member
Joined
Mar 13, 2022
Messages
6
Office Version
  1. 365
Platform
  1. Windows
I need VBA that loops through a single column on one sheet, finds any cell with a "-", then copy and paste it to another separate sheet. The column being looped through will be dynamic.

The first sheet is named "PRO Schedule" and the range starts at "C5". I need it to loop down the column to the last entry and find the part numbers. I think searching for "-" will give me all of them. Here is a screenshot of this sheet.

PRO Schedule Screenshot.jpg


The VBA will be in a button on the sheet that the found values will be pasted. This sheet is called "SIMPLE Schedule" and the first cell where the found values are to be pasted is "B5".

SIMPLE Schedule Screenshot.jpg


I have searched for a solution on the forums but can not make anything fit. Any help would be greatly appreciated!
 
If that formula works in 365 then I think this should work in 2016 as well

Excel Formula:
=IFERROR(INDEX('PRO Schedule'!C:C,AGGREGATE(15,6,ROW('PRO Schedule'!C$5:C$2500)/((ISNUMBER(FIND("7161675",'PRO Schedule'!C$5:C$2500))+ISNUMBER(FIND("55369603",'PRO Schedule'!C$5:C$2500))+ISNUMBER(FIND("AA",'PRO Schedule'!C$5:C$2500))+ISNUMBER(FIND("AB",'PRO Schedule'!C$5:C$2500))+ISNUMBER(FIND("AC",'PRO Schedule'!C$5:C$2500))+ISNUMBER(FIND("AG",'PRO Schedule'!C$5:C$2500))+ISNUMBER(FIND("-",'PRO Schedule'!C$5:C$2500)))*ISERROR(FIND("+/-",'PRO Schedule'!C$5:C$2500))),ROWS(B$5:B5))),"")

Peter,

This worked brilliantly! Thanks again for taking a look, really appreciate it.

Brandon
 
Upvote 0

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

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