Abhijeet
Abhijeet

Reputation: 269

How to store Chinese characters in variable?

I need to get a cell value in a variable.

This cell value has Chinese characters in it.

When I try to get the cell value, I get '????' instead.

enter image description here

enter image description here

Upvotes: 1

Views: 1040

Answers (1)

Romcel Geluz
Romcel Geluz

Reputation: 603

Not a valid answer, just to show the OP how I deal with non-English characters.

1) with a sample data like this.

enter image description here

2) create a userform with

1. ListBox defaultname = ListBox1

2. TextBox defaultname = TextBox1

3. CommandButton defaultname = CommandButton1

enter image description here

Paste this code

Option Explicit
Dim rCell As Range

Private Sub CommandButton1_Click()
rCell.Cells(ListBox1.ListIndex + 1).Value = TextBox1.Value
Refresh_Values
End Sub

Private Sub ListBox1_Click()
  With ListBox1
    TextBox1.Value = .List(.ListIndex)
  End With
End Sub

Private Sub UserForm_Initialize()
Refresh_Values
End Sub

Sub Refresh_Values()
Dim a() As Variant
  Set rCell = Sheet1.Range("A1:A7")
  a() = rCell.Value
  ListBox1.List() = a()
End Sub

*1 if there are changes in the listbox. it will reflect in the textbox.

*2 if you click save it should reflect unto the sheet.

*3 it refreshes the values so that the change made with the value will reflect in the listbox.

Hope this will help you. Good luck!

Upvotes: 1

Related Questions