Darren Smith
Well-known Member
- Joined
- Nov 23, 2020
- Messages
- 631
- Office Version
- 2019
- Platform
- Windows
It says the Method Range of object worksheet failed.
What do I have to alter?
The "GantrySizes" is the named range
What do I have to alter?
The "GantrySizes" is the named range
VBA Code:
Private Sub Gantry_Height_Width_Change()
Dim ws As Worksheet
Dim LastRow As Long
Dim LastColumn As Long
Dim StartCell As Range
Set ws = ThisWorkbook.Worksheets("GantryID")
Set StartCell = ws.Range("A1")
LastRow = ws.Cells(ws.Rows.Count, StartCell.Column).End(xlUp).Row
LastColumn = ws.Cells(StartCell.Row, ws.Columns.Count).End(xlToLeft).Column
ws.Range("GantrySizes").Value = ws.Range(StartCell, ws.Cells(LastRow, LastColumn))
End Sub
Last edited: