How to create nested vba loop to find the minimum value of each column using a vba subroutine?

Connor872

New Member
Joined
Aug 31, 2021
Messages
2
Platform
  1. MacOS
Hi all,

I am just wondering how I would go about creating a nested for loop to go through each of the columns to obtain the required value. I am aware that the worksheetfunction.min exists however I don't want to use that to obtain the result.


Table 1
DateStock 1Stock 2Stock 3Stock 4Stock 5Stock 6Stock 7
31/1/17​
1​
11​
7​
16​
8​
3​
11​
28/2/17​
2​
12​
8​
17​
9​
4​
10​
31/3/17​
3​
13​
9​
18​
10​
5​
12​
30/4/17​
3​
13​
9​
18​
10​
5​
12​
31/5/17​
2​
12​
8​
17​
9​
4​
9​
30/6/17​
4​
14​
7​
19​
11​
6​
11​
31/7/17​
5​
15​
8​
20​
12​
7​
13​
31/8/17​
4​
14​
9​
19​
11​
6​
13​
30/9/17​
6​
16​
8​
15​
13​
8​
14​
31/10/17​
7​
17​
6​
12​
14​
9​
14​
30/11/17​
6​
16​
7​
12​
13​
8​
13​
31/12/17​
6​
16​
8​
11​
13​
8​
14​
31/1/18​
5​
15​
9​
14​
12​
7​
14​
28/2/18​
8​
14​
8​
15​
15​
10​
16​
31/3/18​
9​
13​
7​
16​
16​
11​
16​
30/4/18​
10​
12​
8​
17​
17​
12​
18​
31/5/18​
11​
11​
7​
17​
18​
13​
18​
30/6/18​
11​
10​
9​
16​
18​
13​
20​
31/7/18​
10​
11​
7​
18​
17​
12​
17​
31/8/18​
12​
12​
7​
20​
19​
14​
19​
30/9/18​
14​
13​
8​
21​
21​
16​
22​
31/10/18​
15​
15​
9​
20​
22​
17​
24​
30/11/18​
14​
14​
9​
18​
21​
16​
23​
31/12/18​
12​
15​
9​
16​
19​
14​
21​
Minumum price (For loop)
Minimum price location (For loop)
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Why would you want to run loops, when you don't need to?

Also what is your expected result from that data?
 
Upvote 0
Why would you want to run loops, when you don't need to?

Also what is your expected result from that data?
my expected results are:
1​
10​
6​
11​
8​
3​
9​
row3row20row12row14row3row3row7

The reason why I want to run loops is that it is required for my coursework to utilize a nested loop for our selected stocks. However, I'm struggling with how to actually reach that.
 
Upvote 0
As this is coursework, you will need to show what you have done yourself even though it doesn't work.
 
Upvote 0

Forum statistics

Threads
1,215,043
Messages
6,122,816
Members
449,095
Latest member
m_smith_solihull

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