Help!

mckenshie

New Member
Joined
Apr 6, 2021
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I am trying to figure out how to continuously do a function starting from x = 0 to x = 20 with an increment change of 0.1. I want to use vba to list all the values that resulted to a sign change in an array but I have no clue on where to start. Please help.
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Welcome to MrExcel Message Board. This is example:
VBA Code:
Sub multiply()
Dim i As Long, Arr(0 To 200) As Variant
For i = 0 To 200
Arr(i) = (i * 0.1) * Range("A1").Value
Next i
Range("B1").Resize(201).Value = Application.WorksheetFunction.Transpose(Arr)
End Sub

1. You can replace Range("A1").Value with your formula
2. Last line only added to you see array result within excel sheet. If you don't need, delete it.
 
Upvote 0
Wellome,
here is one more...
VBA Code:
Sub For0To20()
   
    Dim x As Integer, N As Integer, Result
   
    N = 10
    For x = 0 To 20 * N
        Result = x / 10 + N / 100
        Range("A" & x + 1) = Result
    Next x
   
End Sub
 
Upvote 0
Another option
VBA Code:
Sub mckenshie()
   Dim Ary As Variant
   
   Ary = Evaluate("row(10:200)/10")
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,621
Messages
6,125,884
Members
449,269
Latest member
GBCOACW

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