Help with VB Code

sambf1991

New Member
Joined
Aug 10, 2011
Messages
2
I'm trying to auto sort by value, but the cells in which the values are contain functions. I have a code for if they contain just numbers but is their a way to sort when containing functions?

My table looks like this

Base ----- Income ----- Cost ----- Income:Cost
Nuc ------- $$ --------- $$ ------- =(B2/C2)
Pow ------- $$ --------- $$ ------- =(B3/C3)
Com ------- $$ --------- $$ ------- =(B4/C4)
Sta -------- $$ --------- $$ ------- =(B5/C5)
Oil -------- $$ ---------- $$ ------- =(B6/C6)


I would like to autosort column D, descending.

Thanks in advance.
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Welcome to the board!

What do you mean by "autosort?" When should the data be sorted? Generally, I would expect some specific range being typed into (column B or C?) to trigger a macro that simply sorts based on column D... I wouldn't think having those formulas in column D would change your procedure at all.
 
Upvote 0
The "cost" is constantly changing for each base, meaning the income:cost ratio is also changing. I would like the bases to sort automatically by income:cost ratio.
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,831
Members
452,946
Latest member
JoseDavid

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