Excel - Leading Space (??) visible in Cell but NOT in Formula Bar - vba

In a cell the string "Usha" appears with what looks like a leading space, but in the Formula bar it appears correctly. Also, using LEFT(A1,1) returns "U" and not any other character. What is the cause of this behavior and what are the possible solutions (both UI and VBA)?

Check the indent of that cell.
Use the left of the red marked buttons to remove the indent.

Check the format of the cell. I pasted text into a cell formatted as "Accounting" and observed the leading space in the cell (e.g. ' ABC') but not the formula bar. Changed the cell format to Text and the space disappeared.

Related

excel rowheight - a bug here?

Excel seems to work with the row heights in the following (il)logic:
If you refer to a single cell and your cell is defined "Wrap Text" and the row height is "Autofit":
When you enter more characters than what can fit to the cell width the row in the cell is changed automatically and in the end, when you press "Enter", the row height is expanded so that the whole text is visible.
If you refer to combined cells and your cell combination is "Wrap text" and "Autofit":
When you enter more characters than what can fit to the combined cells' width the row is NOT changed automatically and after "Enter" the row height is NOT adjusted to show the whole text.
I think this is not logical.
What would be the trick to get excel to automatically adjust the row height also in the case of "Wrap Text" combined cells? Any VBA solutions? (Basically you could, maybe, count how many line changes the combined cell has and adjust the rows.height property accordingly but...

Excel: Background of cell not recognised

Hopefully a quickie.
I have a bizarre case of a cell having a background colour, but excel not recognising it as such.
Upon right click > format cell, no fill is shown, no rgb value assigned to this cell. but the cell is coloured and it can be copied only with VBA's .copy or the Paste Specials Keep Source Formatting and Values & Source Formatting
I would really like to know whats going on, as well as how to edit Tim's code here to copy this colour.
Thank you for your time.
Conditional formatting is not recognized as a background color in VBA.
https://msdn.microsoft.com/en-us/library/office/ff822801.aspx

If content in a cell is too long, show "Multiple" instead of letting the text overflow in Excel

So, I have a custom function that concatenate different cells and put a comma between words.
For example, say I have "ABCD" "BC" then, this function will
output ABCD, BC. Now the problem is that the text will overflow in a cell and overlap with the cell next to that. In order to solve this problem,
I am thinking of just replacing the concatenated word with "Multiple" if more than 3 words are combined. Is there anyway to do this in a cell?
You can do this with conditional formatting AND keep the original underlying string as a raw value for other purposes.
Select the cells with the formula and create a conditional formatting rule based on a formula.         =LEN(C2)-LEN(SUBSTITUTE(C2, ",", ""))>1 
Click Format and go to the Numbers tab. Choose Custom from the list down the left side and supply the following for the Type:         ;;;[color13]_((\multipl\e)   I've opted to also make the font dark blue (colorindex # 13) and indent from the left.
Click OK to accept the formatting and then OK again to create the new rule.
        
As you can see in the sample image above, the underlying raw value remains (shown in the formula bar) but (multiple) is displayed.
More on custom number formatting codes at Number format codes

In powerpoint VBA, how to change the spacing of a font in a textbox?

Do you know what the command in VBA is in order to space out some text?
I looked on the internet and didn't find anything that would work.
this "SOMMAIRE" textbox has no spacing
and this, is what I want that textbox to look like :
there is more space in between the letters
more exactly, I am looking for the VBA code for this exact button :
Use the shape's .TextFrame2.TextRange.Font.Spacing property. By default it is probably 0. You can change it to other values to increase the font spacing.
Just wanted to add that auto-kerning is also a factor so you'll want to remove that too:
'Set character point spacing to zero
.TextFrame2.TextRange.Font.Spacing = 0
'Remove automatic kerning
.TextFrame2.TextRange.Font.Kerning = False
The kerning property can be viewed manually if you select the shape and in the Font group on the HOME ribbon, click the notch in the bottom right and then go to the Character Spacing tab - you will see a checkbox there where this property is set.

Getting display text as ###### for some of the cell in excel after writing from Vb.net code

I am writting to an excel file from my vb code. The code goes as below
xlsheet3 = xlBook.Sheets.Add(After:=xlSheet)
With xlsheet3
.Columns(5).NumberFormat = "#"
.Cells(j + 1, 5) = someStringValue 'Here "j" is a row counter and this line is in a "for loop"
end with
After writing to excel, most of the cells in excel are correct. But some of the cell's text comes as ####### however if I click on the cell, formula bar shows the correct result. I have tried giving single code before adding the text still that did not help.
Please help me in resolving this.
Thank you
There is not any issue with your code. You need to increase the width of the column or have to use word wrap. In excel if your value is not fully visible it shows it is "######".
If widening and wrapping text doesn't work and the format is set to text which allows display of only 255 characters, try changing the format to general.
This just indicates that the cell is too small for showing the result: make it wider.
See https://superuser.com/questions/65556/excel-displays-for-long-text-whats-wrong for some common reasons why Excel displays "######" in cells.
Either the cell is too narrow to display the contents or the contents are over 256 characters.
Check what you're writing to the cell. If it's not too long then all you need to do is resize the column to fit the new contents.
This is simply what Excel does when the data in a column is too wide to be displayed in the current column width. Make the column slightly wider and you will see all your data.
To autosize the column so it is wide enough to display all its data, double click the column divider at the right edge of the column, in the header bar.