Re: range comparision
it works well! i have to replace some features, but the identification of the securities and portfolios works!
i have another question. if you could give a short tip, i would be very happy. in your code there is an avarRangeNames array. in my task the ranges are first identified and then named with VBA like this:
Sub SuchenUndBenennen()
Dim i As Integer
Dim StartRow As Integer
Dim EndRow As Integer
Dim PortArray As Variant
Dim Port As Variant
Dim ExitDo As Boolean
Dim BondName As String
Dim iRow As Integer
Dim iCol As Integer
Dim avarRangeNames() As Variant
Dim ItemNum As Integer
ItemNum = 1
PortArray = Array("B0293", "F0325", "MF005", "F0354")
'passes all names to array
For Each Port In PortArray
Do
'looks for start and end of the respective ranges
StartRow = Cells.Find(What:=Port, After:=Cells(1, 1), LookAt:=xlWhole).Row
If StartRow > 1 Then
ExitDo = True
Else
ExitDo = False
End If
Loop Until ExitDo = True
i = StartRow
'in order to find the last row of the range, starts to search from the row,
'where it found through do loop the first security of Port
Do
i = i + 1
Loop Until Cells(i, 1).Value <> Port
EndRow = i
'passes to EndRow (just for convenience)
ActiveSheet.Names.Add Name:="Portf" & Port, RefersToR1C1:=Range _
(Cells(StartRow, 3), Cells(EndRow - 1, 3))
'here it names the ranges
Display More
....and here i have my problems, i will pass the names of ranges to the avarRangeNames... and it does, but if i try to read the items of array (for example with msgbox avarRangeNames(1) it gives empty value
ReDim avarRangeNames(ItemNum)
'ItemNum is 1 till here, i.e. an array with 1 item
avarRangeNames(ItemNum) = "Portf" & Port
ItemNum = ItemNum + 1
what is wrong here?
thanx in anticipation
turbothorup
edit: i have added code tags - jiuk