Ive managed to find the solution and would like to share.
The following code identify the row number and column number where the string exists that is passed via function and then click the button which has ID containing row number. first of all the code will look for the heading of the table and identify the column number where the string (lstrColumnHeaderName) exists then look for row number where the string (lstrStringToFind ) exists.
Function fnLMDiscoverRowColumn(lstrColumnHeaderName As String, lstrStringToFind As String)
Dim LMTable As Object
Dim lstrTableId AS String
Dim LMrCount As Integer
Dim LMcCount As Integer
Dim LMrow As Integer
Dim LMcolumn As Integer
lstrTableId = "PI-Table-01"
<font color="green"> ' Atach the current web page</font>
<font color="green"> ' Identify the HTML table based on the ID of the first cell in the table</font>
Set LMTable = HTMLTable("FirstCellID=" & lstrTableId, tpAttachWait)
LMrCount = LMTable.RowCount <font color="green"> ' Identify number of Row for the table</font>
LMcCount = LMTable.ColumnCount(1)<font color="green"> ' Identify the number of Columns for the table</font>
For LMcolumn = 1 To LMcCount <font color="green"> ' Loop for the header table, check the string that is defined for
<font color="green"> ' search the header row (row = 1) for the desired heading (eg: Reference)</font>
If InStr(LMTable.GetCellText(1, LMcolumn), lstrColumnHeaderName) > 0 Then
<font color="green"> ' for each row of data (ie: not row = 1 which is the header row) in the desired column
' The reason loop is starting from 2 is because row 1 is header of the table and row 2
' Contains the data.</font>
For LMrow = 2 To LMrCount
<font color="green"> ' Loop until string is found. User need to define the value for lstrStringToFind when
' calling the function</font>
If Trim(LMTable.GetCellText(LMrow, LMcolumn)) = lstrStringToFind Then
<font color="green"> ' Click on the button that contains ID with row number</font>
HTMLAnchor("ID=button-ci-change-" & LMrow, tpAttachNoWait).Click
I did try the line of code you have mentioned but for some reason it did not work for me and i cannot not explain why. may be I have to navigate through pagination control and when it goes to next set of row it loses the row number and does not populate me the correct row number thats why i had to implement my own row or column finder.