Carriage Returns in Headings but if used in Range wont find

shell_l_d

Board Regular
Joined
Jun 25, 2010
Messages
73
If I enter carriage returns of Chr(10) in a cell, I cant seem to select the cell heading in the code below unless i take out the Chr(10) code. Is there a trick to this please?

Code:
        ' Extra Headings
        .Cells(row, col + 1).FormulaR1C1 = "Calc" & Chr(10) & "Eval Date"
        
        ' Extra Values
        .Cells(row + 1, col + 1).FormulaR1C1 = "=IF(RC9=""Null"",DATE(2010,3,31),RC9)"

        ' Date Time field format
        Range("tblGlobalData[[Calc Eval Date]:[Calc Compl Date]]").NumberFormat = "dd mmm yyyy hh:mm"
 

Some videos you may like

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

SamTYler

Well-known Member
Joined
Mar 10, 2004
Messages
784
Enter it into the heading cell as "Calc Eval Date" and format the cells' alignment property as wrap text. Use it in formulas the same way, "Calc Eval Date."
 

shell_l_d

Board Regular
Joined
Jun 25, 2010
Messages
73
Yeah I'm already using it that way, only problem is when use AutoFit, it makes a difference if the heading is:

Calc Eval Date

or

Calc
Eval Date
 

SamTYler

Well-known Member
Joined
Mar 10, 2004
Messages
784
Do it that way, note the column width, add a hard code width in your code after each Autofit. I know it's a PITA, but that's Excel.
 

Watch MrExcel Video

Forum statistics

Threads
1,095,752
Messages
5,446,294
Members
405,395
Latest member
anilals

This Week's Hot Topics

Top