单元格范围和vlookup的问题

问题描述 投票:0回答:1

我正在Excel中使用转换器Hex到Binary。我在Vba中使用了Vlookup,但是它没有像我期望的那样工作,因为在单元格中我有“0000”,但是函数只写了一个0。我怎么解决这个问题?

Cells(8, 7) = Application.WorksheetFunction.VLookup(Range("G7"), Range("U6:V21"), 2)

excel vba excel-vba
1个回答
1
投票

您需要将单元格的格式更改为文本才能获得文本结果:

Cells(8, 7).NumberFormat = "@" 'text
Cells(8, 7) = Application.WorksheetFunction.VLookup(Range("G7"), Range("U6:V21"), 2)
© www.soinside.com 2019 - 2024. All rights reserved.