I have been asked if there is any way to get Excel to produce an overstrike effect in a cell. My first attempt was the use the BACKSPACE character:
="A" & CHAR(8) & "B"
But the display does not seem to honor the BACKSPACE:
Is this a font problem? Is there a unicode approach ?
I hate to tell the client to search for a custom font.
EDIT#1:
For example. This code:
Sub XBar()
ActiveCell.Font.Name = "Arial MS Unicode"
ActiveCell.Value = "X" & ChrW(773)
End Sub
Visually produces:
but this is not a general solution.
You can extend the character set by putting one character on top of another BUT you can only do this with a limited set of symbols. These are known at the "Combining Diacritical Marks" and usually live towards the end of the font set.
For a spreadsheet document, I wanted to put in 9 recurring (ie 9 with a dot above it). This does not exist as one character but can be made by combining two.
First of all put in the 9, then from the Combining Diacritical Marks, choose the . and one will go above the other. I actually had to do this in Word and then copy and paste the new characters back to Excel to make them work.
Once in Excel, I used a look up to convert the digit 9 into the dotted digit 9 wherever I needed it.
Different fonts have different ranges of these characters. Arial Unicode MS has some unusual ones. You need to look at the fonts and choose the most appropriate for your needs.
However, on the whole, I don't think you can put a B on top of an A!
Are you trying to do this?
If so, then select the character(s) you'd like to strikethrough, click the arrow icon in the font section (circled below) and tick the box next to strikethrough.
See here for more information.
Related
Problem:
I have a sentence/word I need to past in an excel cell. It consists of an Arabic word, along with some numerical values (in English). For example, let's say I want to write the below
However, excel keeps returning the below
2,1 - الحدث
It you notice, the numerical values are always moved to the left of the word, while I want to keep it on the right.
I tried concatenating, but didn't seem to help. I am open to any solution, vba or not, as I have spent a lot of time on this with no luck.
I added this keyboard to my device and it helped me with that.
Central Kurdish Keyboard
Use it to write the numbers only, and use the normal arabic keyboard to write the rest of the text.
And note that it didn't work with the numpad, it worked only with the numbers row at the top - the one that has the special characters !##$%^&*()
Sorry the previous question I posted is not very detailed.
Is there any VBA code where I can change the number while keeping the word constant within a cell? Since I'm from Indonesia, and doing a monthly report regarding the amount of production being produced by the production line, the word for box is "dus", so I was searching for a solution where I input a number and the word "dus" will appear along with it within the same cell. I'd like it to appear as the following:
23 dus
44 dus
15 dus
12 dus
As can be seen within the example, the numbers changed, the word "dus" remains the same. I'm new to VBA, so I don't know what codes should i use in order for it to function.
In VBA you can set the NumberFormat property. This uses the same syntax as the 'Format Cells...' option from right-clicking a cell, but, as you are adding text, you need to use double quotes to indicate a single quote.
Range("A1:A12").NumberFormat = "#"" dus"""
which is entered as #" dus" in the 'Format Cells...' dialog box.
I am entering a string in a Userform in Excel-VBA from the user side of the form. I would want to know how to enter the Long Hyphen.
The Small Hyphen would be Shift + - the (the minus sign button next to 0).
How would you enter the Long Hyphen on the form as I am doing a string match in my VBA code on the back-end? It can be entered with Alt+0150, but is there another simpler way?
If the option of entering the Long Hyphen doesn't work then I will handle this value on the back-end through a find and replace method or something in VBA.
👆 There is only one "Hyphen"... It's part of a ᖴᗩᗰᎥᒪƳ ᴏғ ᑕᕼᗩᖇᗩᑕ丅ᗴᖇᔕ called Dashes.
Examples:
Hyphen [-] (-)
Minus sign [−] (−)
En dash [–] (–)
Em dash [—] (—)
✱ Your browser might render them differently, but the fonts above are supposed to be [Consolas or Courier 13px] and (Arial or Helvetica 15px). While they all kind of look the same in this font, those are four different characters.
The characters can be copy/pasted directly from here - − – — into Excel (but not to the the VBA Editor), or can be produced along with 136,686 other Unicode characters, either:
with a worksheet formula, using the ᴜɴɪᴄʜᴀʀ function:
=UNICHAR(9733) 'produces a [★] star character.
programmatically with VBA, using the ChrW function:
Range("A1") = ChrW(9743) 'puts a wee [☏] rotary phone in cell A1.
More about dashes —
What they are
How to use them
"Stealing" Unicode characters from websites
There are all sorts of handy Unicode symbols — so many that it can be hard to find "just" the right one.
However you can (and will!) find other Unicode symbols on web pages that you want to use programmatically. All you need is the symbol's code, which can be determined easily:
Copy/paste the symbol from your browser (being careful to copy only the single character; no spaces, etc.) into a cell in Excel
then, go to VBA's Immediate Window ( AltF11→CtrlG ), type:
MsgBox AscW([a1])
...(Where A1 is the cell with the character). Hit Enter, and the character's Unicode code will display.
You could also use Windows' built-in Character Map utility, or one of many third-party browser plug-ins. You can even paste a symbol directly into Google to learn more about it:
Finally, no discussion on the topic of Unicode would be complete without links to:
👉 The Unicode Consortium (unicode.org) and,
👉 “ȶɦɛ 𝓒𝓸𝓸𝓵 𝕱𝖆𝖓𝖈𝖞 Ⓣⓔⓧⓣ 𝔾𝕖𝕟𝕖𝕣𝕒𝕥𝕠𝕣” (Yes, those are all plain text characters.)
...and if you're looking for a unique gift, or just want your name to go down in history for something that really matters, you can even adopt a Unicode character, starting at $100 ᴜsᴅ!
Special thanks to Vinton Cerf for adopting the Unicode Leonard Nimoy's "Live Long and Prosper" symbol.
🖖
I've got a long list of codes and text in the same cell. I need to return all the text from the right BUT the first five characters
ex. V2341 something here
I need to return the something here
=RIGHT(LEN(A1)-5)
That's what I've tried, but no luck with it. I know it's gotta be close to correct, what am I missing?
Thanks.
You're looking for MID.
If column A contains
A C D
==================== ====================== ==============
1 ABCDE12345 D1=MID(A1, 6, LEN(A1)) 12345
2 ABCDE1234567890ABCD D2=MID(A2, 6, LEN(A2)) 1234567890ABCD
REPLACE function can also be used to replace a designated number of characters with nothing, i.e.
=REPLACE(A1,1,5,"")
You can also select the whole column, use ctrl+f, then find and replace the 'v' with nothing. This will work easily if you have the same first amounts you are trying to get rid of.
If you are trying to get rid of the same number of characters, but they are different characters, you can go to Data -> Text to Columns (in Data Tools Sections). Then select the radio button fixed width. Click Next. Move the line in the graphic to the position you want it in, click Finish.
I have word lists where the word or expression in Spanish is separated by its translation with a colon (":"). I want to make two columns, one for Spanish, the other for English. In vim I tried with
:%s/:/^I^I^I/g
But it does not give the desired output. The different columns are not aligned.
When deleting the colon by hand and inserting the number of tabs with the same amount of tab strokes, it always ends up aligned.
Any idea how to solve this, preferably in vim?
On a Linux/*nix system I use column(1)
:%!column -s':' -t
followed by
:%retab!
I'd probable do a
:s/:/^I/g
followed by a
:set ts=25
Where 25 is the length of the longest word expected + 2. So, if you expect the longest word of your input (on the left side of the colon) to be 12 characters, I'd choose something around 14 instead.
With Tabular.vim it's quite easy, just type :Tab /:\zs and it does the rest.
When in insert mode a setting of yours makes tab to reach a nth column. This is set with the 'softtabstop' settings if I am right.
For those tasks you could use a plugin like Align.vim or Tabularize.
Another option is to insert a huge number of spaces, and then use Visual Block with < operator as many times as necessary, if you have to do it once. Otherwise prefer reusable methods.