Locating a value in a table with VBA

nosjojo

New Member
Joined
Jul 21, 2011
Messages
6
I'm writing a project that ultimately does a huge chunk of electrical engineering work automatically, and I've hit a wall with this one process.

I'm trying to search through this table of values: http://www.houwire.com/products/technical/article310_16.html

This is the NEC reference table to determine if a wire is large enough to handle the current going through it.

My script is suppose to grab the current value from a list and read the table column associated with the wire I will be using. An example of this is:

Copper Cable
Max Amperage: 194
Cable Temp: 90C

So I would read through column for 90C in Copper, and I'd find 195. Since 195 is the next highest value in the table for my wire, I'd select that. However, my problem doesn't stop here, This value isn't going to be the one I use. I need to use this value to help do a bunch of site specific checks, and eventually I'll settle on a number of 260.

Once I have this number, I need to cross reference that number to the AWG size on the far right, in this case it's 4/0.

Hopefully that explanation isn't too messy. My current approach is to find 195 and get the address. Then while I go through my conditional checks, I use offset to adjust which cable I have selected.

The code I tried to use this:
Code:
Dim WireAmpLoc As Range
Set WireAmpLoc = WorksheetFunction.Match(amp_max, ActiveWorksheet.Range("TempDataColumn"), -1)

TempDataColumn is a range that defines my 90C column, amp_max is the calculated amperage I need to match against. The code is throwing a mismatch, which I believe is because Match returns a number and not a range. Is there a way to make this return a range or a different function that can do this search?
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,224,590
Messages
6,179,750
Members
452,940
Latest member
rootytrip

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