redim preserve

  1. G

    Add local array to public array - loop redim preserve

    Hi, I have a loop that used to get arrays from individual worksheets and then combine and write out to one worksheet. I'm trying to get better at dealing with arrays and avoiding repeated read/write to worksheets...sufficed to say, its still a struggle. Goal: Take each array that populated via...
  2. wsnyder

    Option Base 1 But LBound Is 0

    Hi all, Using Excel 365. I have Option Base 1 at the top of my Modules However my code is returning Subscript Out of Range error And when I hover over the array variable for LBound it shows as 0. thanks, -w Error here: Debug.Print vCriteria(i), vColumns(i) Full code: Option Explicit...
  3. wsnyder

    Error in VBA Find Function

    Hi all, Using Excel 365. My Function is returning an error: Public Function FindColumnHeader(rng As Range, _ SearchTerm As String) As Long FindColumnHeader = rng.Find(what:=SearchTerm, _ LookIn:=xlValues, _...
  4. B

    VBA adjusting an existing user function to operate on rows instead of columns

    I need help adjusting an existing UDF to meet a new need. The script below is designed to take a vertical range of cells with comma separated values, then add all the values together and display the result in the same form- Like so... 6,4,1 5,6,1 3,2,1 ________ 14,12,3 Make sense? It works...
  5. 2

    ReDim Preserve Query

    Hi, I have the following vba code, which populates an array with the contents of the first 5 rows of column A. Sub populate_array() Dim parameters_2DArray as Variant parameter_2DArray = Worksheets("Sheet1").Range("A1:A5").Value [rest of code] End Sub I'm assuming the parameter_2DArray...
  6. T

    How do I insert non-adjacent columns into an array?

    Hello all you MrExcel experts I have a sheet with 26 columns and approximately 250,000 rows of data. The number of columns will stay the same, however, the number of rows will increase. I will be comparing data in columns 'B, D, N, Q', and depending of the results of that comparison, some...
  7. S

    Using an Array & Autofilters - VBA

    So thanks to a number of kind people here, I have been guided and helped a number of times. Thank you to those that have done so and been patient with my questions as well as lack of understanding. I am learning and your guidance challenges me to learn me. Thank you! I have a scenario where I...
  8. W

    Redim doesn't work after script was run successfully

    Hi there, I managed to run the script only once without error. But now I get a value error and it seems that the Redim is not resizing the arrays. Originally I used Redim Preserve but after the error I also tried to resize them at the initialization, but neither of them seems to work now. Here...
  9. S

    Array question

    Hi, I have a simple question regarding arrays. According to the MSDN help, the first element of a 2D array is located at (0,0) MSDN Link https://msdn.microsoft.com/en-us/library/02e7z943.aspx But, in my code, if I do the following: Sub test2() 'Table with Header-A in Cell(10,10) '...
  10. T

    Redim a dynamic 2D array error - subscript out of range

    I am writing a VBA code which loops through a defined range in a worksheet, finds the filled cells within its limits and assigns the x,y values of each cell into an array. This is my code: Sub FindCells() Dim lWidth as Integer, lHeight as Integer 'both of these parameters are subject to...
  11. C

    Compile error: Array already dimensioned

    Dim GrpTot(1, 2) 'Col 1 : Amt 'Col 2 : row no for Where to put 'col 3 : Column no for where to put GrpTot(0, 0) = 4896.00 GrpTot(0, 1) = 5 GrpTot(0, 2) = 2 Sheets("Summary").Cells(GrpTot(0, 2), GrpTot(0, 1)) = GrpTot(0, 0) ReDim Preserve GrpTot(2 To 2) GrpTot(0, 0) = 12541.00...
  12. V

    Filling a single dimension array, using values from a two dimensional array

    I have these numbers that I put into Array1. I then want to put 16 '11s' into Array2, then add 3 '20s', then 40 '9s' etc. And at last paste Array2 into C1. This code gives me 91 '11s' in column C.Sub Test() Dim Number1 As Integer, Number2 As Integer, i As Integer, j As Integer, Start As...
  13. P

    Subscript our of range with ReDim Preserve and UBound

    Hello. I partly created a code which tries to group data based on the values of an array. The problems are that I'm trying to extract data from multiple worksheets that belong to the same workbook so ReDim Preserve seems to fall out of range when the code reaches the 2nd worksheet. I'm not sure...

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