Excel VBA, error 438 "object doesn't support this property or method

前端 未结 1 1236
感情败类
感情败类 2020-12-11 23:18

I have this code in which I\'ve been getting help with a bit, but I\'ve run into an issue, or what I think is an issue. The last lookup, I am being told that the object does

相关标签:
1条回答
  • 2020-12-12 00:05

    The Error is here

    lastrow = wsPOR.Range("A" & Rows.Count).End(xlUp).Row + 1
    

    wsPOR is a workbook and not a worksheet. If you are working with "Sheet1" of that workbook then try this

    lastrow = wsPOR.Sheets("Sheet1").Range("A" & _
              wsPOR.Sheets("Sheet1").Rows.Count).End(xlUp).Row + 1
    

    Similarly

    wsPOR.Range("A2:G" & lastrow).Select
    

    should be

    wsPOR.Sheets("Sheet1").Range("A2:G" & lastrow).Select
    
    0 讨论(0)
提交回复
热议问题