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...
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...
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...
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.
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...
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...
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...
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...
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...
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...
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...
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$ &...
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...
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
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?
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...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.