I want to find the text in a worksheet that resides in two cells (it is a column heading split into 2 cells). What code should I use to find the text string split into 2 cells? Any insight would be helpful! Thanks, Rasberry
Thanks for responding. I am actually writing VBA code. I am trying to write code that searches the spreadsheet for the two consecutive cells and then it will perform another task after it finds those contiguous cells.
If the cells are in the same row, this might work (untested):
' -Code assumes columns A and B are the headings
dim i as long
dim iFound as long
dim sTemp as string
for i = 1 to 1000 'Your first row to your last row
sTemp = Range("A" & i).value & " " & Range("B" & i).value
if sTemp = "Rtn on Equity" Then
iFound = i
'Continue on from here with i as the row number with the found heading
This could also be converted into a function and called from a main subroutine.
Thanks! I haven't got it to work, yet. But it is something to start with. I'm working on getting the coding that will cycle through a range rather than just two columns. Basically the spreadsheet. But this is very helpful!