LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
A A is offline
external usenet poster
 
Posts: 37
Default Assign Results from If...Then and Loop to an Array (VBA)

Given the basic structure below, anyone know how to add the results (10 of them) from the If...Then statements inside the For Next loop to an empty array ?

---------------------------------------------------------------------
For i = 1 to 10

If ()= True Then
cvtVariable = "Text"

ElseIf ()= True Then
cvtVariable = "Number"

ElseIf ()= True Then
cvtVariable = "Error"

Else
cvtVariable = "Blank"

End If

Next i

-----------------------------------------------------------------------

Dim cvt1 As String
Dim cvt2 As String
Dim cvt3 As String
Dim cvt4 As String
Dim cvt5 As String
Dim cvt6 As String
Dim cvt7 As String
Dim cvt8 As String
Dim cvt9 As String
Dim cvt10 As String

Dim CellValueTestVariableArray As String

Dim cvtVariable As String

CellValueTestVariableArray = Array(cvt1, cvt2, cvt3, cvt4, cvt5, cvt6, cvt7, cvt8, cvt9, cvt10)

-------------------------------------------------------------------
The result would look something like this, for example:

cvt1 = "Text"
cvt2 = "Blank"
cvt3 = "Error"
cvt4 = "Number"
cvt5 = "Number"
cvt6 = "Blank"
cvt7 = "Number"
cvt8 = "Text"
cvt9 = "Error"
cvt10 = "Text"

------------------------------------------------------------------

Thanks,

Paul

 
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
Assign Values to array Jeff Excel Discussion (Misc queries) 14 July 15th 08 06:06 PM
Assign Cell Values without a Loop BHatMJ Excel Discussion (Misc queries) 4 May 29th 08 04:26 PM
Can't assign to Array .GetRows in Excel 97 Lenn Excel Programming 2 June 24th 04 02:30 AM
How do I assign values to an array? Skyway[_2_] Excel Programming 14 February 29th 04 01:22 AM
Possible to assign an array to a SeriesCollection Stephen Boulet Excel Programming 2 November 13th 03 06:36 PM


All times are GMT +1. The time now is 08:01 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"