Hi
I have this formula to find a row number
The method from which this line is called passes the sheet as a parameter, so I know that the sheet is always the right one.
I call this line after either of two things (see sample code below)
(1) if there is an option to choose from, then load a form and allow the user to choose a value. <<<< The find function returns 0!
(2) If there is a single option then just paste the single option directly in the cell matching the IDRow found using the find function. <<<< this works fine, and the find function finds the value.
Even worse... when I debug and I stop at the End If above... then I pull the execution cursor to repeat the execution, it returns the correct value for IDRow !!
You can see that I have Trim there, because I'm trying to see if there the format is bothering it.. I removed all formatting, and still it is inconsistent ...
I'm very confused... anything you'd suggest that I look for?
Thanks for your time.
HannaH
I have this formula to find a row number
Code:
IDRow = MySheet.Range("A1:A10").Find(Trim("ID"), LookIn:=xlFormulas).Row
The method from which this line is called passes the sheet as a parameter, so I know that the sheet is always the right one.
I call this line after either of two things (see sample code below)
(1) if there is an option to choose from, then load a form and allow the user to choose a value. <<<< The find function returns 0!
(2) If there is a single option then just paste the single option directly in the cell matching the IDRow found using the find function. <<<< this works fine, and the find function finds the value.
Code:
If UBound(TArray) > 0 Then
FormControls.populateLabelsForm (TArray)
Else
IDRow = MySheet.Range("A1:A10").Find(Trim("ID"), LookIn:=xlFormulas).Row
TVCol = MySheet.Range(MySheet.Cells(IDRow, 1), MySheet.Cells(IDRow, 30)).Find("TV", LookIn:=xlValues).Column
MySheet.Cells(TargetCell.Row, TVCol).Value = CStr(TArray(0))
End If
Even worse... when I debug and I stop at the End If above... then I pull the execution cursor to repeat the execution, it returns the correct value for IDRow !!
You can see that I have Trim there, because I'm trying to see if there the format is bothering it.. I removed all formatting, and still it is inconsistent ...
I'm very confused... anything you'd suggest that I look for?
Thanks for your time.
HannaH