|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Dim YiChang As Variant
Dim ZhiXiang As Variant
Dim YongLiang As Variant
ReDim YiChang(1 To UBound(XDCM), 1 To 2)
ReDim ZhiXiang(1 To UBound(XDCM), 1 To 4)
ReDim YongLiang(1 To UBound(XDCM), 1 To 4)
Stop
On Error Resume Next
ssw = Application.Match("后中长", BuWei, 0)
For i = 1 To UBound(XDCM)
YiChang(i, 1) = XDCM(i, 1)
YiChang(i, 2) = CCB(ssw, i)
If YiChang(i, 2) + 4 < 72 And PinMing = "童装" Then
ZhiXiang(i, 1) = "2024黑金4.0-防尘袋1号"
ZhiXiang(i, 2) = "定制黑金纸箱"
ZhiXiang(i, 3) = "黑金防潮袋(中号)"
ZhiXiang(i, 4) = "热敏纸箱贴(三防)"
ElseIf ZhiXiang(i, 2) + 4 < 95 Then
ZhiXiang(i, 1) = "2024黑金4.0-防尘袋2号"
ZhiXiang(i, 2) = "定制黑金纸箱"
ZhiXiang(i, 3) = "黑金防潮袋(中号)"
ZhiXiang(i, 4) = "热敏纸箱贴(三防)"
Else
ZhiXiang(i, 1) = "2024黑金4.0-防尘袋3号"
ZhiXiang(i, 2) = "定制黑金纸箱(中号)"
ZhiXiang(i, 3) = "黑金防潮袋(大号)"
ZhiXiang(i, 4) = "热敏纸箱贴(三防)"
End If
YongLiang(i, 1) = 1
If PinMing = "童装" Then
If ZhiXiang(i, 1) = "2024黑金4.0-防尘袋1号" Then
YongLiang(i, 2) = 0.0384
YongLiang(i, 3) = 0.0384
YongLiang(i, 4) = 0.0384
ElseIf ZhiXiang(i, 1) = "2024黑金4.0-防尘袋2号" Then
YongLiang(i, 2) = 0.0769
YongLiang(i, 3) = 0.0769
YongLiang(i, 4) = 0.0769
ElseIf ZhiXiang(i, 1) = "2024黑金4.0-防尘袋3号" Then
YongLiang(i, 2) = 0.1
YongLiang(i, 3) = 0.1
YongLiang(i, 4) = 0.1
End If
Else
If ZhiXiang(i, 1) = "2024黑金4.0-防尘袋1号" Then
ElseIf ZhiXiang(i, 1) = "2024黑金4.0-防尘袋2号" Then
YongLiang(i, 2) = 0.1111
YongLiang(i, 3) = 0.1111
YongLiang(i, 4) = 0.1111
ElseIf ZhiXiang(i, 1) = "2024黑金4.0-防尘袋3号" Then
YongLiang(i, 2) = 0.125
YongLiang(i, 3) = 0.125
YongLiang(i, 4) = 0.125
End If
End If
Next
sh11.Range("a40").Resize(2, UBound(YiChang)) = YiChang()
sh11.Range("a50").Resize(UBound(ZhiXiang), 4) = ZhiXiang()
sh11.Range("a60").Resize(UBound(YongLiang), 4) = YongLiang()
定义静态数组,正常写入数据,但是我想把数组里的值写入单元格的时候,单元格显示为空白,不报错。指针移动到数组里比如: yichang() 编辑器显示“<下标越界>” 这是为什么呢? 我的程序里面另一个数组同样的方向却能写入单元格,哪里有问题呢?
|
|