Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I have recently started to try to learn VBA for Excel. I have experience in Matlab. I am trying to create a simple column vector. I take a user input from my spreadsheet and then create an evenly spaced vector which starts 10% below the input and ends 10% above the input. If anyone knows Matlab, this could be done in one line, like this: IL = (ILi-ILi*0.1):100:(ILi+ILi*0.1) So far I have only managed to do this in a rather ugly loop (code below). Is this really the easiest way to do this? Thanks, David ------------------------------ Sub Temp_correct() ' Define variables Dim IL(), ILi As Integer 'Get initial values from user input ILi = Range("C5") 'Set up boundaries +/-10% for trial solutions i = 1 'Counter IL(i) = ILi - ILi * 0.1 Do While IL(UBound(IL)) < (ILi + ILi * 0.1) IL(i + 1) = IL(i) + 100 i = i + 1 Loop End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how to plot velocity vectors? | Charts and Charting in Excel | |||
Vectors on Charts | Charts and Charting in Excel | |||
adding vectors.. help on how | Excel Discussion (Misc queries) | |||
Multiple Vectors Notation | Excel Discussion (Misc queries) | |||
Eigenvalues and vectors | Excel Programming |