Hi,
I have this macro to look at a cell and if it finds a certain value, copy that row to another sheet. My formula works if there is only Text in the cell and fails if a formula is creating the text in the cell.
Example Data:
<tbody>
</tbody>
<tbody>
</tbody>Now, with the data above in Column B... There is an underlying formula to figure this out (see below):
So, even though you "see" the words Residential, Retail, Commercial, or Senior Living, the cell actually contains the above formula.
The Problem...
If I copy the contents of Column B and then Paste-Special-Values into Column C... my macro code works perfectly to find all Residential rows and copy and paste them into another sheet.
However, if I try to run my macro on Column B, my macro can not find the "Residential" lines...
Here is the code that I can't quite get to see the text in those cells...
I have also tried using .Value in the place of .Text. How do I get my macro to look for the visual text "Residential"?
Thank you for any help!
I have this macro to look at a cell and if it finds a certain value, copy that row to another sheet. My formula works if there is only Text in the cell and fails if a formula is creating the text in the cell.
Example Data:
Col A | Col B | ||||
Row 1 |
<tbody> </tbody> |
<tbody> </tbody> | |||
Row 2 |
<tbody> </tbody> |
<tbody> </tbody> | |||
Row 3 |
<tbody> </tbody> |
<tbody> </tbody> | |||
Row 4 |
<tbody> </tbody> |
<tbody> </tbody> | |||
Row 5 |
<tbody> </tbody> |
<tbody> </tbody> | |||
Row 6 |
<tbody> </tbody> |
<tbody> </tbody> | |||
Row 7 |
<tbody> </tbody> |
<tbody> </tbody> |
<tbody>
</tbody>
<tbody>
</tbody>
Code:
=IF(B2="","",IF(LEFT(B2,2)="PM","Senior Living",IF(LEFT(B2,2)="CP","Commercial",IF(LEFT(B2,1)="R","Retail",IF(LEFT(B2,2)="CU","Commercial","Residential")))))
So, even though you "see" the words Residential, Retail, Commercial, or Senior Living, the cell actually contains the above formula.
The Problem...
If I copy the contents of Column B and then Paste-Special-Values into Column C... my macro code works perfectly to find all Residential rows and copy and paste them into another sheet.
However, if I try to run my macro on Column B, my macro can not find the "Residential" lines...
Here is the code that I can't quite get to see the text in those cells...
Code:
If Range("B" & CStr(LSearchRow)).Text = "Residential" Then
I have also tried using .Value in the place of .Text. How do I get my macro to look for the visual text "Residential"?
Thank you for any help!