Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. cg85cg

    error when transfering array to range

    Here is the code, all other code has been commented out. the problem lies somewhere in the following lines Option Base 1 Sub Profitability() Dim mostup() ReDim mostup(1 To Workbooks("Most Up.xls").Worksheets(1).UsedRange.Rows.Count, _ 1 To Workbooks("Most...
  2. cg85cg

    run time error 1004 when transposing array to range

    yes option base one is true. i have an array that i am putting values into from other arrays. this array needs to be transfered to a worksheet. the range of cells to which the array is being transfered will be defined in size by the array itself by using UBound(array). the line that originally...
  3. cg85cg

    run time error 1004 when transposing array to range

    hmm...yes that is what i mean. I have never run into a problem where my rows and columns have been switched by the transpose funtion, there was nothing to suggest that transpose meant to switch them. i found the transpose function when searching online for how to put the contents of an arraty...
  4. cg85cg

    run time error 1004 when transposing array to range

    huh...well that's interesting. how should i fix this problem? i could write a loop that would switch the rows and columns before I transpose, but i'm sure there is a more elegant solution.
  5. cg85cg

    run time error 1004 when transposing array to range

    i am confused. I thought that when declaring a 2D array the format is this: DIM mostup(rows,columns)
  6. cg85cg

    run time error 1004 when transposing array to range

    Here is the trouble line Workbooks("Most Up.xls").Worksheets(1).Range(Cells(1, 1), Cells(UBound(mostup, 1), UBound(mostup, 2))).Value = mostup Similar lines have worked in other programs When this line is executed: mostup is a 2 dimensional array (1 to 64350, 1 to 31) The array is being...
  7. cg85cg

    ReDim Preserve array to erase unwanted values, subscript error

    oh i got it. i just thought maybe you were saying there is a special trick for switching around the array. I will give that a shot for sure.
  8. cg85cg

    ReDim Preserve array to erase unwanted values, subscript error

    jeez, you guys really went to town on this thread. To start, option base 1 is true I am actually manipulating three arrays in the same way, I have them all intitially declared as variants because when i fill the arrays with data from a range, some cells in the range have "-", this signifies...
  9. cg85cg

    ReDim Preserve array to erase unwanted values, subscript error

    In a program I am writing I cycle through some arrays in order to get rid of a few unwanted values. the loop goes through the array and finds the value it doesn't like and then shifts each element after that up one. When the loop completes, I am left with a bunch of elements (not empty) that I...
  10. cg85cg

    need to put union of two ranges into 2D array

    steve, i absolutely agree with you. a database would be better for what i am doing. I chose to use excel because the data i am working with comes to me in excel files and i am fairly comfortable with excel. An older version of the code i am writing would have taken something like 77 days to...
  11. cg85cg

    need to put union of two ranges into 2D array

    i'm just afraid that would take too long. it takes about 12 seconds for VBA to loop through 3000 cells. it will do this 252 times per year and for 7 years for a total of 5.88 hours. I need to write faster code. I need to take the entire range and put it in. i know i can do it with a 1D range...
  12. cg85cg

    Subscript out of range, error 9 with array

    i'm just afraid taht would take too long. it takes about 12 seconds for VBA to loop through 3000 cells. it will do this 252 times per year and for 7 years for a total of 5.88 hours. I need to write faster code. I need to take the entire range and put it in. i know i can do it with a 1D range...
  13. cg85cg

    need to put union of two ranges into 2D array

    A program that I am writing requires that i put two different columns into a two dimensional array. the code line that gives the problem is: daydata = Application.Union(Range("a1:a" & dayrows), Range(datatype$ & "1:" & datatype$ & dayrows)) The array has been previously ReDimed as...
  14. cg85cg

    Subscript out of range, error 9 with array

    hey combo, that solved the problem, thanks. But now i've got another problem. Another program that I am writing requires that i put two different columns into a two dimensional array the code line that gives the problem is: daydata = Application.Union(Range("a1:a" & dayrows), Range(datatype$ &...
  15. cg85cg

    Subscript out of range, error 9 with array

    I am writing a section of code that would go through an array and set repeat values to "" (null). I am using a For-Next loop to look at each element in the array. on the first iteration of the loop i get the runtime error 9, subscript out of range. It is clear to me that the variable i am using...
  16. cg85cg

    Runtime error 1004 when copying column to other workbook

    Thank you all for your suggestions. I ended up solving the problem by more explicitely defining ranges to be copied instead of columns, and by being more sequential when pasting. book1.sheet.range.copy book2.sheet.range.paste
  17. cg85cg

    Runtime error 1004 when copying column to other workbook

    So, Combo, the Rows.Count function counts all the rows in the worksheet? Should I write a seperate loop to count the rows manually or is there a function I can use to count the used rows only?
  18. cg85cg

    Runtime error 1004 when copying column to other workbook

    I am relatively new to VBA and have run into a problem i can not solve through tinkering of the code or searching of the web. Run-time error '1004': Application-defined or object-defined error To summarize. I am trying to copy a column of undefined length starting at cell A1 from one...

Part and Inventory Search

Back
Top