for each 遇到的问题

Justin1818 Justin1818 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

Private Type CFSReceivingdata
SO As String
KGS As Integer
CBM As Single
Yn As Boolean
rwindex As Integer
End Type
Private CFSRecedata(50000) As CFSReceivingdata

..............
..............
With TagSheet
For Each rwobj In .Rows
Dim cfsobj As CFSReceivingdata
cfsobj.SO = Trim(.Cells(rw, 1).Text)
cfsobj.KGS = CInt(Trim(.Cells(rw, 12).Text))
cfsobj.CBM = CSng(Trim(.Cells(rw, 11).Text))
cfsobj.Yn = False
cfsobj.rwindex = rw
CFSRecedata(i) = cfsobj
rw = rw + 1
i = i + 1
Next
End With

'Error message is :
'For each may not be used on array of user-defined type or fixed-length string

for each obj in CFSRecedata '<---CFSRecedata 被加亮

..........
..........
next

请朋友纠正并指出出错的原因

...全文
评论 6
收藏 已收藏
分享
返回顶部
Justin1818
Office开发/ VBA 5,174 成员 17,906 内容