gpt4 book ai didi

excel - 最后一行问题

转载 作者:行者123 更新时间:2023-12-03 02:20:40 28 4
gpt4 key购买 nike

我在最后一行表达式和自动填充方面遇到一些问题。我不确定我在这里缺少什么,因为它看起来是正确的,但它似乎没有在正确的单元格中启动 vlookup(N2,它在 N1 中启动它),并且它不会自动填充到最后一行M. 任何朝正确方向的插入将不胜感激。我想这是我忽略的一件小事。

 Sub Nightly()
'
' Nightly Macro
'
Dim PackSpec As Workbook
Dim FullBook As Workbook
Dim DebFile As Workbook
Dim lrow As Long

lrow = Cells(Rows.Count, 1).End(xlUp).Row


'Open the nightly pack spec file, cut and insert the year row into column D
Set PackSpec = Workbooks.Open("S:\Accounting\Apps\Packspec\CIDExport\Archive\" & Year(Date) & "\" & Month(Date) & "\" & Day(Date) - 1 & "\*.csv")
Columns("A:A").Select
Selection.Cut
Columns("D:D").Select
Selection.Insert Shift:=xlToRight
Range("A2").Select

'Open Fullbook master and insert columns after N then VLookup between Pack Spec and Fullbook
Set FullBook = Workbooks.Open("S:\Corporate\Groups\Comosoft\Downloads\FullBook\fullbook_Master.csv")
Columns("N:U").Select
Selection.Insert Shift:=xlToRight
Range("N2").Select

'Actvate Fullbook and enter Vlookup for dates
Windows("fullbook_Master.csv").Activate
With ActiveSheet.Range("N2")
.FormulaR1C1 = "=VLOOKUP(RC[-1],'[15.50.1.CID.csv]15.50.1.CID'!C[-13]:C[-11],3,0)"
.AutoFill Destination:=Range("N2:N" & lrow) 'issue not autofilling to end
Windows("fullBook_Master.csv").Activate
End With

End Sub

最佳答案

只需移动

lrow = Cells(Rows.Count, 1).End(xlUp).Row

之后

Windows("fullbook_Master.csv").Activate

关于excel - 最后一行问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53123747/

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