Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
String 为什么中间有一个空间?VBA excel_String_Vba_Excel_Concatenation - Fatal编程技术网

String 为什么中间有一个空间?VBA excel

String 为什么中间有一个空间?VBA excel,string,vba,excel,concatenation,String,Vba,Excel,Concatenation,基本问题,VBA入门 StoreValueLocCol = Left(StoreValueLoc, 1) StoreValueLocRow = Int(Right(StoreValueLoc, 2) + 1) StoreValueLoc = StoreValueLocCol & Str(StoreValueLocRow) MsgBox(StoreValueLoc) 我想在ExcelVBA中下一行,但是当我连接字符串时,它们之间存在一个空格 我用这个作为解决方案,但我想找出空间存在的原因

基本问题,VBA入门

StoreValueLocCol = Left(StoreValueLoc, 1)
StoreValueLocRow = Int(Right(StoreValueLoc, 2) + 1)
StoreValueLoc = StoreValueLocCol & Str(StoreValueLocRow)
MsgBox(StoreValueLoc)
我想在ExcelVBA中下一行,但是当我连接字符串时,它们之间存在一个空格

我用这个作为解决方案,但我想找出空间存在的原因

StoreValueLoc = Replace(StoreValueLoc, " ", "")

Str
添加前导空格。使用CStr或仅连接:

StoreValueLoc = StoreValueLocCol & CStr(StoreValueLocRow)
或:


Str
添加前导空格。使用CStr或仅连接:

StoreValueLoc = StoreValueLocCol & CStr(StoreValueLocRow)
或:


它有助于让人们了解数据类型等,这样我们就可以很好地了解您要实现的目标

我假设
StoreValueLoc
是一个范围变量。如果要分隔列和行,可以使用
符号来利用内置的VBA函数。见下文:

storeValueLocRow = storeValueLoc.Row
storeValueLocCol = storeValueLoc.Column
MsgBox(storeValueLocRow & ", " & storeValueLocCol)

注意:如果范围不是单个单元格的列和行,函数将返回范围中的第一列和第一行

这有助于让人们了解数据类型等,以便我们了解您试图实现的目标

我假设
StoreValueLoc
是一个范围变量。如果要分隔列和行,可以使用
符号来利用内置的VBA函数。见下文:

storeValueLocRow = storeValueLoc.Row
storeValueLocCol = storeValueLoc.Column
MsgBox(storeValueLocRow & ", " & storeValueLocCol)

注意:如果范围不是单个单元格列和行,则函数将返回范围中的第一列和第一行

尝试vbNewLine或vbCrLfTry vbNewLine或vbCrLf