gpt4 book ai didi

excel - VBA 如果值与特定 Dim 的名称相同,则获取值的 Dim

转载 作者:行者123 更新时间:2023-12-04 21:44:00 26 4
gpt4 key购买 nike

如何链接CSVTypeColumn = CSVType01 = "AL" ?
如果 CSVTypeColumn.value = CSVType01然后CSVTypeColumn.value = "AL" ?

'''''Module1
Public CSVType01 As String
CSVType01 = "AL"

'''''Module2
For CSVTypeColumnCount = 1 To 6
Dim CSVTypeColumn As String
CSVTypeColumn = "CSVType0" & CSVTypeColumnCount
Dim FindCSVType As Range
Set FindCSVType = .Range(CSVTypeColumn & 1).Column '<-- Wrong here!

最佳答案

使用数组:

Public CSVType(1 To 6) As String
CSVType(1) = "AL"
' etc
For CSVTypeColumnCount = 1 To 6
Dim CSVTypeColumn As String
CSVTypeColumn = CSVType(CSVTypeColumnCount)

关于excel - VBA 如果值与特定 Dim 的名称相同,则获取值的 Dim,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69986796/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com