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

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
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,064
Messages
6,122,942
Members
449,094
Latest member
teemeren

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