macro help please

formratings

Board Regular
Joined
Apr 5, 2015
Messages
119
Office Version
  1. 2019
Platform
  1. Windows
sorry if this is simple but I am new to all of this,
I was wondering if there is a macro that I could just
add to any old workbook easily got about 200
that has to run through increments of eg 1 to 100 on three cells LOAD C6,C7,C8 to achieve the best outcome in a targeted cell =races!$AC$33
WHEN they all run together whereas C6 will affect C7 etc
or run all individually and save best setting/outcome as default
thanks and I hope I have explained this correctly
dave
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
I think i have understood what you want, try this. ( it will take some time to run 1 to 100 on each of the 3 cells)
VBA Code:
Sub test()
bestresult = 0
For i = 1 To 100
 Range("C6") = i
  For j = 1 To 100
   Range("c7") = j
    For k = 1 To 100
      Range("C8") = k
      Cresult = Worksheets("races").Range("AC33")
      If Cresult > bestresult Then
       bestresult = Cresult
       besti = i
       bestj = j
       bestk = k
      End If
     Next k
   Next j
 Next i
 
 MsgBox ("Best Results = " & bestresult & "at " & besti & "/" & bestj & "/" & bestk)
 
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,216,474
Messages
6,130,841
Members
449,598
Latest member
sunny_ksy

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