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

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
62,383
Office Version
  1. 365
Platform
  1. Windows
Why would you want to run loops, when you don't need to?

Also what is your expected result from that data?
 

Connor872

New Member
Joined
Aug 31, 2021
Messages
2
Platform
  1. MacOS
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.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
62,383
Office Version
  1. 365
Platform
  1. Windows
As this is coursework, you will need to show what you have done yourself even though it doesn't work.
 

Forum statistics

Threads
1,141,293
Messages
5,705,532
Members
421,399
Latest member
hjweiss00

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
Top