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"
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

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,129,479
Messages
5,636,575
Members
416,925
Latest member
malamutus

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
Top