VBA Set Named Range

DRWonoski

Board Regular
Joined
Mar 20, 2014
Messages
99
In a workbook I have titles to a table in Row 2. I want to set a named column based on those titles as publicly accessible throughout all of the code in the workbook. I'm currently getting a Compile Error: Type Mismatch with .Match being highlighted. Thoughts?

Code:
 Public ColPWSN As Range
Code:
Set ColPWSN = WorksheetFunction.Match("PW SN", ActiveWorkbook.ActiveSheet.Range("2:2"), 0)
 
Here's the big picture - I have a few different stores that all track orders using an excel spreadsheet similar to what you see below. Each one is named "Town Order Tracker". I also have a "master" file that feeds all of the columns you see highlighted in tan. "Pull2" comes from Master!Sheet1 and "Pull1" comes from Master!Sheet2,3,4,5, or 6 (each store has their own sheet. All information is found on Pull1 first, and then when entered into our ERP system it gets moved to pull2 (AKA anything that shows Pull2 currently has a formula to state "TBD" until a match is found on Pull2.

I want an easier way to add new lines and mark orders as shipped. When orders ship, I currently copy everything and paste as values so the index(match isn't lost when orders fall off of Pull1. I then change a column to say "closed" instead of open.

To add a new order, I want an input box to appear asking for the PO number. I then want excel to look in "Pull2" to determine whether it is "Cat, Dog, or Elephant" and place a new formatted line below the last of that type. All tan shaded boxes should automatically pull from Pull1 or Pull2. If the PO isn't found, I want the employee to be able to manually enter whatever Cat or Dog and then manually add any Pull 1 Information.

Before State: https://imgur.com/eKLjNil
After Adding New Dog: https://imgur.com/yTTrKlY
After "Shipping" Dog: https://imgur.com/Klsvmv0
 
Upvote 0

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
I'll be away a few days. I'll check back when I can to see if this is resolved.
 
Upvote 0

Forum statistics

Threads
1,215,429
Messages
6,124,839
Members
449,193
Latest member
MikeVol

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