【发布时间】:2018-08-10 08:54:08
【问题描述】:
我从查询中获取原始数据到 Excel,在执行 VLOOKUP 时,有时我必须手动计算或计算我要引用的列。
如果我在用户表单文本框中输入例如“M”,我想要一个计算器,而另一个文本框将显示“M”的正确列号 (13)。
我的用户表单如下所示:
我想出了类似下面代码的东西,我将每个字母调暗为一个整数,当它输入到文本框中时,它会相互添加值。
我不知道如何编写 CommandButton1_click "Räkna"。
Private Sub CommandButton1_Click()
'how do i transform letters into numbers here?
End Sub
Sub raknare()
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim d As Integer
Dim e As Integer
Dim f As Integer
Dim g As Integer
Dim h As Integer
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim l As Integer
Dim m As Integer
Dim n As Integer
Dim o As Integer
Dim p As Integer
Dim q As Integer
Dim r As Integer
Dim s As Integer
Dim t As Integer
Dim u As Integer
Dim v As Integer
Dim w As Integer
Dim x As Integer
Dim y As Integer
Dim z As Integer
Set a = 1
Set b = 2
Set c = 3
Set d = 4
Set e = 5
Set f = 6
Set g = 7
Set h = 8
Set i = 9
Set j = 10
Set k = 11
Set l = 12
Set m = 13
Set n = 14
Set o = 15
Set p = 16
Set q = 17
Set r = 18
Set s = 19
Set t = 20
Set u = 21
Set v = 22
Set w = 23
Set x = 24
Set y = 25
Set z = 26
End Sub
【问题讨论】: