我想从另一个工作簿复制区域。
来源:区域从J15开始到J列的最后一行。我在语法上有点问题。
目标:粘贴区域与源工作簿中的区域相同,但为K列(从K15到J列的最后一行)
问题出在with语句上。我一直收到这个错误:https://pasteboard.co/HsxMzPZ.jpg
用于澄清的源表图片https://pasteboard.co/Hs8gDsF.jpg
Public Sub Subledger_Makro()
Dim Subwb As Workbook
Dim Subsht As Worksheet
Dim Sourcewb As Workbook
Dim SourceSht As Worksheet
Set Subwb = ActiveWorkbook
Set Subsht = Subwb.Sheets("SAPBW_DOWNLOAD")
SourceFile = Application.GetOpenFilename(, , "Open yesterdays Subledger Report")
Set Sourcewb = Workbooks.Open(SourceFile)
Set SourceSht = Sourcewb.Sheets("SAPBW_DOWNLOAD")
'Copies the previous day Subledger (SourceSht) report J-Column to new the Subledgers (DestSht) K-column
' DestSheet is todays Subledger
' SourceSheet is the previous day Subledger
With SourceSht
.Range(.Cells(15, "J"), .Cells(.Cells(.Rows.Count, "J").End(xlUp).Row, "J")).Copy Destination:=Subwb.Subsht.Range("K15")
End With
Application.CutCopyMode = False
End Sub发布于 2018-07-02 13:43:38
替换此行
.Range(.Cells(15, "J"), .Cells(.Cells(.Rows.Count, "J").End(xlUp).Row, "J")).Copy Destination:=Subwb.Subsht.Range("K15")使用
.Range(.Cells(15, "J"), .Cells(.Cells(.Rows.Count, "J").End(xlUp).Row, "J")).Copy
Subsht.Range("K15").PasteSpecial xlPasteAllhttps://stackoverflow.com/questions/51129463
复制相似问题