Forum Discussion
chahine
Jan 26, 2022Iron Contributor
vba cells
hello i have a question, like i want to find last row number in a used range so when i use this code Debug.Print ActiveSheet.UsedRange.Cells(rows.count, 5).End(xlUp).Row it gives an error, alth...
- Jan 26, 2022Range references are relative, so if your data is in A17:D30, then that is your usedrange. So, 1048576 rows down from row 17 is beyond excel's row limit and you'll get an error.
Try: ActiveSheet.Cells(rows.count, 5).End(xlUp).Row
JMB17
Jan 26, 2022Bronze Contributor
Range references are relative, so if your data is in A17:D30, then that is your usedrange. So, 1048576 rows down from row 17 is beyond excel's row limit and you'll get an error.
Try: ActiveSheet.Cells(rows.count, 5).End(xlUp).Row
Try: ActiveSheet.Cells(rows.count, 5).End(xlUp).Row
- chahineJan 26, 2022Iron Contributorgreat thanks a lot !