Hi everyone,
I am working on a project to clean up an excel spreadsheet. I have two columns H & I, that have doctor specialties. I need to run a search in these two columns and find the specific text "Internal medicine" if this value is found, I need to copy that text into Column J. If any other text is found in columns H&I, that text needs to go into column K.
This is what I have so far:
Sub copyif()
Dim SrchRng As Range, cel As Range Set SrchRng = Range("h2:i2") For Each cel In SrchRng If Range("H2").Value = "Internal Medicine" And Range("I2").Value = "Internal Medicine" Then
End Sub
I don't know if I am starting this code correctly and can't figure out the code's copy portion.
I was using: =IF(ISNUMBER(SEARCH function but I need to find text in two columns and return the value "Internal Medicine" into Column j if that specific text is found and if any other text is found in Columns H&I then that text needs to be copied into column K. I am guessing VBA code is the only way to accomplish this task.
I am working on a project to clean up an excel spreadsheet. I have two columns H & I, that have doctor specialties. I need to run a search in these two columns and find the specific text "Internal medicine" if this value is found, I need to copy that text into Column J. If any other text is found in columns H&I, that text needs to go into column K.
This is what I have so far:
Sub copyif()
Dim SrchRng As Range, cel As Range Set SrchRng = Range("h2:i2") For Each cel In SrchRng If Range("H2").Value = "Internal Medicine" And Range("I2").Value = "Internal Medicine" Then
End Sub
I don't know if I am starting this code correctly and can't figure out the code's copy portion.
I was using: =IF(ISNUMBER(SEARCH function but I need to find text in two columns and return the value "Internal Medicine" into Column j if that specific text is found and if any other text is found in Columns H&I then that text needs to be copied into column K. I am guessing VBA code is the only way to accomplish this task.