
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
I have a PbDataWindow that I would like to search for a row with specific text in a column and then activate the cell. Unfortunately I've not been able to locate the method for doing so. Right now I'm having to use SelectCell and identify the row then ActivateCell for that row number, but that row can change periodically depending on the environment I'm in.
Thoughts? Thanks
Accepted Solutions


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
You can write a custom method, below is the rough idea. You can write it your way.
To find the column index: row = 1 'or 0 i.e. headers row no For col = 1 To objPBDW.ColumnCount If objPBDW.GetCellData(row, col) = strData Then Exit For End If Next If column names property is available, you can use that value also to find the column index. To find record with text: For row = 1 To objPBDW.RowCount If objPBDW.GetCellData(row, col) = strData Then Exit For End If Next
All the thoughts here are mine not related to my employer nor anyone.
Test Automation Ecstasy

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
You can write a custom method, below is the rough idea. You can write it your way.
To find the column index: row = 1 'or 0 i.e. headers row no For col = 1 To objPBDW.ColumnCount If objPBDW.GetCellData(row, col) = strData Then Exit For End If Next If column names property is available, you can use that value also to find the column index. To find record with text: For row = 1 To objPBDW.RowCount If objPBDW.GetCellData(row, col) = strData Then Exit For End If Next
All the thoughts here are mine not related to my employer nor anyone.
Test Automation Ecstasy

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Shanmugavel,
Tried your method - below is what I wrote up:
For row = 1 to PbWindow("lems"). PbWindow("elect").PbDataWindow("select").RowCount
If PbWindow("lems"). PbWindow("elect").PbDataWindow("select").GetCellData (row,col) = "GEBERTS" Then
Exit For
End If
Next
It runs and local variables show:
Name Value Type Name
Row 23 Long
Col Empty User-defined Type
In my datawindow, I have a column named Code. I’m attempting to locate the cell in that Code column that says GEBRTS, then have the script activate that cell for me. Forgive my newness, trying to give what info I can.
Thanks!


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
assign value to variant col. See your table and assign the column no.
All the thoughts here are mine not related to my employer nor anyone.
Test Automation Ecstasy

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
okay - so added col=1 to the mix
so basically it searches until it finds my GEBRTS, then just moves on and my attempts to Activate that cell after it's found have failed - what would I need to add to the code in order to activate this cell after the search finds it.
Thanks again!


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Once you found that row, your row and col values are there. then you need to use ActivateCell(row, col) or SelectCell(row, col)
I just gave you the sample to find the row, that's all.
All the thoughts here are mine not related to my employer nor anyone.
Test Automation Ecstasy

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Great thank you!
My code is now:
col = 1
for row = 1 to PbWindow("lems"). PbWindow("elect").PbDataWindow("select").RowCount
If PbWindow("lems"). PbWindow("elect").PbDataWindow("select").GetCellData (row,col) = "GEBERTS" Then
PbWindow("lems"). PbWindow("elect").PbDataWindow("select").ActivateCell (row,col)
Exit For
End If
Next
It's throwing a syntax error telling me that "you cannot use parentheses when calling a sub"

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Never mind - fumbled around a bit but got it going - thank you both so much!