I'm familiar with VB.NET, but VBA in excel has me stumped. With my best attempt, I get a "Type mismatch" error:
Sub AddQuotes()
For Each x In Range("List").Cells
x.Text = "*" * " & x.text & " & "*"
Next
End Sub
I find the easiest way is to double up on the quotes to handle a quote. *Note: CHAR() is used as an Excel cell formula, e.g. writing "=CHAR(34)" in a cell, but for VBA code you use the CHR() function.
CHR is the VBA function and returns the character from the ASCII table. For example, Chr(34) returns 34th character, which is the “ sign (double quotes).
Try using chr(34) for the double-quote character
eg chr(34) & x.text & chr(34)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With