string - 为什么中间有空格? VBA excel

标签 string vba excel concatenation

这个问题在这里已经有了答案:





Remove whitespace in VBA excel

(2 个回答)


6年前关闭。




基本问题,VBA 入门

StoreValueLocCol = Left(StoreValueLoc, 1)
StoreValueLocRow = Int(Right(StoreValueLoc, 2) + 1)
StoreValueLoc = StoreValueLocCol & Str(StoreValueLocRow)
MsgBox(StoreValueLoc)

我想在 excel VBA 中向下一行,但是当我连接字符串时,它们之间存在空格。

我将其用作解决方案,但我想找出该空间存在的原因
StoreValueLoc = Replace(StoreValueLoc, " ", "")

最佳答案

Str添加前导空格。使用 CStr或者只是连接:

StoreValueLoc = StoreValueLocCol & CStr(StoreValueLocRow)

或者:
StoreValueLoc = StoreValueLocCol & StoreValueLocRow

关于string - 为什么中间有空格? VBA excel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35868236/

相关文章:

c - 如何仅使用指针比较字符串的单词词典大小 (aba < ada)

java - 每个字母出现的次数

VBA——对多个切换按钮使用一次点击事件

excel - CurrentRegion.SpecialCells(xlCellTypeVisible) 太慢 - 提高性能的提示?

sql - 转置数据布局

javascript - 将字符串数组拆分为两个数组,每个数组包含原始字符串的一部分

c# - 无法通过 1 个测试用例的同构字符串检查的简单解决方案

ms-access - 确定子窗体/子报表是否具有在 MS Access 中加载的窗体或报表

excel - 在 Selenium VBA 中提取变化的 XPath

excel - 如何在 Excel 2010 数据透视表中创建百分比差异列?