0

I want to create some VBA code such as the following:

fndList.Add "Beat 'em up game", "Beat 'em up"
fndList.Add "Bishōjo game", "Bishōjo"
fndList.Add "Bullet hell game", "Bullet hell"
fndList.Add "Business simulation game", "Business sim"

However, Excel converts line #2 to "Bishojo game", without the special character. How am I supposed to handle characters such as these? Thanks.

Community
  • 1
  • 1
posfan12
  • 2,541
  • 8
  • 35
  • 57
  • Mostly duplicate of [vba - How to type Unicode character in Visual Basic Editor - Stack Overflow](https://stackoverflow.com/questions/24384952/how-to-type-unicode-character-in-visual-basic-editor?noredirect=1&lq=1) -- except that in this case the app is known to be Excel so there are some solutions such as storing the value in a cell – user202729 Oct 05 '21 at 12:09

2 Answers2

5

Sorry, feels like it's been quite a time since the question was raised.
But still I'd like to propose a solution:

Using unicode encoding to represent different language:

Sheet1.Cells(2, 1) = ChrW(&H3091)

which is standing for character ゑ.
Attaching the website you could look up for the encoding: https://unicode-table.com/en/

zx485
  • 28,498
  • 28
  • 50
  • 59
Michael Yun
  • 119
  • 1
  • 2
2

You could store your values in some cells somewhere, and then read them from there:

Sub test()
    Dim fndList As New Dictionary
    Dim c As Range
    Dim v As Variant
    Dim r As Long
    'Read values from A1:B4
    For Each c In Range("A1:B4").Rows
        fndList.Add c.Cells(1, 1).Value, c.Cells(1, 2).Value
    Next
    'Test that they haven't been altered by writing to C1:D4
    Range("C1:C4").Value = Application.Transpose(fndList.Keys)
    Range("D1:D4").Value = Application.Transpose(fndList.Items)
End Sub
YowE3K
  • 23,852
  • 7
  • 26
  • 40
  • Note I edited the code in the OP. I actually need two columns of input. – posfan12 Jun 07 '17 at 01:26
  • @posfan12 - Edited the answer to read two sets of information (keys and values). (I'm assuming that it is a Dictionary you are trying to get the information into - there are easier ways if you just wanted it in, for instance, a 4 x 2 two-dimensional array) – YowE3K Jun 07 '17 at 02:29