我正在尝试编写一些VBA:
尝试在下面定义U时出现错误。希望能得到一些帮助,因为我尝试调试它没有结果。
错误:1004-方法“对象范围” _Worksheet失败
Dim wscombined As Worksheet
Dim wspsimp As Worksheet
Dim u As Integer
Set wscombined = ThisWorkbook.Worksheets("2013-2018 Combined")
Set wspsimp = ThisWorkbook.Worksheets("Pipeline simplified")
u = Application.WorksheetFunction.Max(wscombined.Range("A7:A"))
LastRowU = wspsimp.Range("J" & Rows.Count).End(xlUp).Row
LastRowU.Offset(0, -8).Select
' Increment cell value by 1
ActiveCell.Value = u + 1