excelvba吧 关注:264贴子:262
  • 0回复贴,共1

VBA运行时错误1004错误 ,到.Paste

只看楼主收藏回复

Function filladata(drid As Integer, prid As Integer, pcid As Integer, krs As Integer, kcs As Integer)
rid = 1
For i = prid To prid + krs - 1
If rid < 3 Then
ThisWorkbook.Worksheets("print").Cells(i, pcid) = ThisWorkbook.Worksheets("data").Cells(drid, rid)
ElseIf rid = 3 Then
ThisWorkbook.Worksheets("print").Cells(i, pcid + 1) = ThisWorkbook.Worksheets("data").Cells(drid, rid)
ElseIf rid = 4 Then
ThisWorkbook.Worksheets("print").Cells(i, pcid + 1) = ThisWorkbook.Worksheets("data").Cells(drid, rid)
ElseIf rid = 5 Then
ThisWorkbook.Worksheets("print").Cells(i, pcid + 1) = ThisWorkbook.Worksheets("data").Cells(drid, rid + 2)
ElseIf rid = 6 Then
ThisWorkbook.Worksheets("print").Cells(i, pcid + 1) = ThisWorkbook.Worksheets("data").Cells(drid, rid + 2)
ElseIf rid = 7 Then
ThisWorkbook.Worksheets("print").Cells(i, pcid + 1) = ThisWorkbook.Worksheets("data").Cells(drid, rid - 2)
ElseIf rid = 8 Then
ThisWorkbook.Worksheets("print").Cells(i, pcid + 1) = ThisWorkbook.Worksheets("data").Cells(drid, rid - 2)
ElseIf rid = 9 Then
ThisWorkbook.Worksheets("print").Cells(i, pcid + 1) = ThisWorkbook.Worksheets("data").Cells(drid, rid)
With ThisWorkbook.Worksheets("print")
Call QRMain(Cells(prid + 1, pcid)) '生成二维码核心语句
Call CreateBitmapQRCode(RGB(0, 0, 0), RGB(255, 255, 255)) '设置二维码颜色
Call QRCodeToClipboard
Cells(i - 2, pcid).Select
.Paste
Application.CutCopyMode = False
With Selection '图片是唯一的,设置图片:位置和大小
.ShapeRange.Height = 48
.ShapeRange.Width = 48
.ShapeRange.Left = Cells(i, pcid).Left + (Cells(i, pcid + 1).Width + Cells(i, pcid).Width - 49)
.ShapeRange.Top = Cells(i - 2, pcid).Top + 1
End With
End With
End If
rid = rid + 1
Next
End Function


IP属地:河南1楼2021-10-03 09:32回复