What is the ActiveCell.Value of a wrapped cell

Kanine

New Member
Joined
Apr 12, 2017
Messages
11
Excel experts,

I am new to the forum and this is my first post. I have read the rules and guidelines, and I will do my best to follow them. I apologize if break any rules.

I am working on a macro that searches for certain cell values. I am struggling with the correct syntax of the cell value if wrap text is on. I have searched high and low for this but can't seem to word my searches correctly.

My code is:
Code:
If ActiveCell.Value = "Example cell value"
Where "Example cell value" is in a wrapped cell. "Example" is on the first line and "cell value" is on the second line. I have tried several underscore combinations but none have worked.

Any help is greatly appreciated.
 
Thanks Rick Rothstein. I tried your code and it works perfectly...except for those two cells for some reason.
What do you mean by "except for those two cells"? There is no direct test for those two cells so I don't see what can be failing. All your headers are on Row 1, correct?
 
Upvote 0

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Well, I rebuilt the workbook from scratch. Everything works exactly how I imagined it should. Thank you all for not only helping me fix the issue, but for also improving the code.

FYI, for the two columns giving me a fuss earlier, I changed the value to only be one line visually, and it worked. I then changed it to what it was before the rebuild, and it wouldn't work for the two cells. I ended up changing it back to the one line value and I'm sticking with that. I can't explain it.
 
Upvote 0
What do you mean by "except for those two cells"? There is no direct test for those two cells so I don't see what can be failing. All your headers are on Row 1, correct?
I can't explain it. All headers are on row 1 so it should have worked. Nothing was failing, except for the error message not showing up. It just wasn't triggering the error message when either of those two cells were the active cell. I was using the code:
Code:
ActiveCell.Row = 1 Or ActiveCell.Column <> 2

I'm pretty convinced there was something wrong with that workbook because the rebuild works much faster when I save it, along with the macro working as it should.
 
Upvote 0

Forum statistics

Threads
1,224,825
Messages
6,181,191
Members
453,021
Latest member
pingpong7117

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top