Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Inputing variables

Hi all. I have an input which will have 1 or 3 variables in it, all
seperated by a ",". It would look like this "2000" or "2000, 500, 3000" The
values are the conditions for a loop: the start, step and ending value. I
was trying to read it in using this code.
Holding = Split(I_Wt_Value, ",")
Weight(0) = Holding(0)
Weight(1) = Holding(1)
Weight(2) = Holding(2)
If IsEmpty(Weight(1)) Then
Weight(3) = 0
Weight(2) = Weight(0)
Weight(1) = Weight(0)
Else
Weight(3) = Weight(0) - Weight(1)
End If

The idea was to take the holding value and put it into an array since I
could use it a little easier but if there is one value instead of 3 in the
field, it spits out a "subscript out of range" error. I need to be able to
use it for both of those inputs I have earlier. Any ideas?

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Inputing variables

if(instr(I_Wt_Value,",") = 0 then
I_Wt_Value = I_Wt_Value & ",0,0"
End if
Holding = Split(I_Wt_Value, ",")
Weight(0) = Holding(0)
Weight(1) = Holding(1)
Weight(2) = Holding(2)
If IsEmpty(Weight(1)) Then
Weight(3) = 0
Weight(2) = Weight(0)
Weight(1) = Weight(0)
Else
Weight(3) = Weight(0) - Weight(1)
End If

Or concatenate whatever is appropriate.
--
Regards,
Tom Ogilvy


"Ben H" wrote in message
...
Hi all. I have an input which will have 1 or 3 variables in it, all
seperated by a ",". It would look like this "2000" or "2000, 500, 3000"

The
values are the conditions for a loop: the start, step and ending value. I
was trying to read it in using this code.
Holding = Split(I_Wt_Value, ",")
Weight(0) = Holding(0)
Weight(1) = Holding(1)
Weight(2) = Holding(2)
If IsEmpty(Weight(1)) Then
Weight(3) = 0
Weight(2) = Weight(0)
Weight(1) = Weight(0)
Else
Weight(3) = Weight(0) - Weight(1)
End If

The idea was to take the holding value and put it into an array since I
could use it a little easier but if there is one value instead of 3 in the
field, it spits out a "subscript out of range" error. I need to be able

to
use it for both of those inputs I have earlier. Any ideas?

Thanks!



Reply
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
inputing data using vba [email protected] Excel Discussion (Misc queries) 0 January 10th 06 04:09 AM
inputing data using vba [email protected] Excel Discussion (Misc queries) 0 January 2nd 06 12:56 AM
inputing data [email protected] Excel Discussion (Misc queries) 0 December 28th 05 02:01 PM
Inputing Data Dick Kusleika Excel Programming 0 August 14th 03 09:13 PM
Inputing Data DLS[_3_] Excel Programming 5 August 10th 03 02:16 AM


All times are GMT +1. The time now is 03:05 AM.

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

About Us

"It's about Microsoft Excel"