I Know this forum is for VB.net stuff, but I have a simple question and did not feel like signing up for a VBA forums page, but will if I need too...
In excel, I want to be able to programmatically merge the cells in a row based on the fact that the word "Laboratory" is in any cell in that row, and I want the merge to start at that cell containing the word "Laboratory" and go to the right hand side of the selection. Here is what I have so far which will loop through all of the cells inside of the selection.
this line is close to what I need, but the offset changes:
In excel, I want to be able to programmatically merge the cells in a row based on the fact that the word "Laboratory" is in any cell in that row, and I want the merge to start at that cell containing the word "Laboratory" and go to the right hand side of the selection. Here is what I have so far which will loop through all of the cells inside of the selection.
Code:
For Each cell In selectedRange ' loop through all the cells in the selection
If InStr(cell.value, "Laboratory") > 0 Then ' if this is > 1, this is the cell I am looking for
End If
Next
Code:
Range(cell, cell.Offset(1, 0)).Merge