![]() |
|
#1
|
||||
|
||||
![]()
You really don't want the entire contents of the cell. The entire contents of a table cell is found by looking at the text and paragraph marks that you can see and then adding two more invisible characters - a paragraph character and an end-of-cell character. I normally use a function to strip these out along with trailing paragraph marks that people tend to put in because their quality control is poor.
Code:
Public Function CellText(aCell As cell) As String Dim str As String With aCell str = .Range.Text str = Left(str, Len(str) - 2) While Right(str, 1) = Chr(13) str = Left(str, Len(str) - 1) Wend CellText = Trim(str) End With End Function Code:
If CellText(.Cell(rw, 4) = "5" And CellText(.Cell(rw, 5)) = "A" Then
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#2
|
|||
|
|||
![]() Quote:
Thank you so much , it was good to know that there are some invisible characters that you should be aware of . Your recommendation worked very well with my code . Thank you |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to run colour conditional formatting in just column, not whole table | KateWord | Word VBA | 2 | 09-12-2019 05:30 AM |
Must use VBA to achieve conditional formatting along with expanding table columns? | tinfanide | Excel | 0 | 06-10-2015 12:25 AM |
![]() |
daviieejay | Word VBA | 21 | 12-07-2014 11:08 PM |
![]() |
tinfanide | Excel | 3 | 10-07-2014 10:00 AM |
Conditional Formatting: How to dynamically apply to an expanding table? | tinfanide | Excel | 0 | 10-18-2013 06:34 AM |