Ubound Defined by Variable in Array

ktkelly_1

New Member
Joined
Jun 13, 2019
Messages
17
[FONT=&quot]I am trying to build this array that can be different for each set of data that is consantly growing. This means that I need to have a Ubound that is also growing. Unfortunately when trying to use the counter method to determine how big the Ubound should be everytime I kepp getting an error "Constant expression required". any thoughts?[/FONT]
Do While InStr(ActiveCell.Value, "Column") = 0
a = a + 1
ActivCell.Offset(0, 1).Select
Loop
[FONT=&quot]
[/FONT]

Dim FC(0 To a) As Double
[FONT=&quot] [/FONT]
For i = LBound(FC) To UBound(FC)
If InStr(ActiveCell.Value, "Column") = 0 Then
FC(i) = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
Else
Exit For
End If
i = i + 1
Next i
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
I help you with your code, but better explain why you need to fill out the arrangement.

Note: You must select a cell where there is a row with the word "Column", if it does not enter a loop.

Code:
  cell = ActiveCell.Address
  Do While InStr(ActiveCell.Value, "Column") = 0
    a = a + 1
    ActiveCell.Offset(0, 1).Select
  Loop
  a = a - 1
  ReDim FC(0 To a) As Double
  
  Range(cell).Select
  For i = LBound(FC) To UBound(FC)
    FC(i) = ActiveCell.Value
    ActiveCell.Offset(0, 1).Select
  Next i
 
Upvote 0
With the following you can put the data in an array a :

Code:
Sub test3()
  [COLOR=#0000ff][B]a [/B][/COLOR]= Range(ActiveCell, Cells(ActiveCell.Row, Application.Match("*Column*", Rows(ActiveCell.Row), 0) - 1))
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,907
Messages
6,175,300
Members
452,633
Latest member
DougMo

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