Home |
Search |
Today's Posts |
#11
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Not sure but instead of -
For Each cell In Ratings ReDim Preserve Ratings1(3, rw) Ratings1(0, rw) = Application.VLookup(cell.Value, Sheets("Portfolio").Range("EK4:EL1200"), 2, False) Try REdim Ratings1(lBound(Ratings) to Ubound(Ratings), _ lBound(Ratings, 2) to Ubound(Ratings, 2) then as I mentioned before For rw = lBound(Ratings, 2) to Ubound(Ratings, 2) Ratings1(0, rw) = I don't understand the lookup part If you need to track the original cell row ref, give Ratings an extra level in the first dimension and store the row number in that for later use with the Lookup and why the rw = rw - 1 maybe Step - 1 ? Ratings1(1, rw) = Ratings(1, rw) Ratings1(2, rw) = Ratings(2, rw) Next In passing - Dim Ratings(), rTicker(), Ratings1() As String is same as Dim Ratings() As Variant, rTicker() As Variant, Ratings1() As String perhaps also Dim rw as Long Regards, Peter T Here i have slimmed down the code and gotten rid of all the file paths and assumed that the different sheets are all in the same workbook. I think that it is clearer. Thanks a bunch Public Sub Updater() Dim cell As Variant Dim x, y As Integer Dim Ratings(), rTicker(), Ratings1() As String Dim AsDte As Date Dim iLastRow, i As Long AsDte = InputBox("What Is the As-of-day?") 'Creates the first array given that the date in that column is greater then AsDte i = 2 While (Sheets("All Actions").Cells(i, 9) < "") If UCase(Trim(Sheets("All Actions").Cells(i, 9))) AsDte Then ReDim Preserve Ratings(3, rw) Ratings(0, rw) = Sheets("All Actions").Cells(i, 2).Value Ratings(1, rw) = Sheets("All Actions").Cells(i, 3).Value Ratings(2, rw) = Sheets("All Actions").Cells(i, 7).Value rw = rw + 1 End If i = i + 1 Wend 'this sheet has 2 columns the first with the contents of Ratings(o, rw) and the second with another identifier 'that i want in the new array Ratings1 instead of the old identifier Sheets("Portfolio").Activate 'I realize that there are issues with the vlookup but i really want to know how to create the new array 'with the old data For Each cell In Ratings ReDim Preserve Ratings1(3, rw) Ratings1(0, rw) = Application.VLookup(cell.Value, Sheets("Portfolio").Range("EK4:EL1200"), 2, False) Ratings1(1, rw) = Ratings(1, rw) Ratings1(2, rw) = Ratings(2, rw) rw = rw - 1 Next cell End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Use formulas for array elements | Excel Discussion (Misc queries) | |||
array elements count | Excel Programming | |||
Reference Elements w/in an Array | Excel Discussion (Misc queries) | |||
Non-unique elements in an array | Excel Discussion (Misc queries) | |||
Number of elements in an array | Excel Programming |