LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Creating vectors of numbers

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to plot velocity vectors? Dakujr Charts and Charting in Excel 1 May 2nd 06 10:34 AM
Vectors on Charts Wyvern Charts and Charting in Excel 1 November 22nd 05 12:40 AM
adding vectors.. help on how Ralph2 Excel Discussion (Misc queries) 1 November 1st 05 01:50 PM
Multiple Vectors Notation Bill Martin -- (Remove NOSPAM from address) Excel Discussion (Misc queries) 0 May 3rd 05 06:56 PM
Eigenvalues and vectors goltinfron Excel Programming 1 March 1st 04 03:06 PM


All times are GMT +1. The time now is 01:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"