Hi
Can someone please explain to me how the following statements work?
LastRow = ActiveSheet.UsedRange.Rows.Count
LastCol = ActiveSheet.UsedRange.Columns.Count
I thought what it does was went into the active sheet, scanned the cells for contents, and returned the highest row or column, respectively.
I've used it in several of my macro's and this is what seems to happen. However, I just wrote one now, where cells that contain contents start at row 12 and end at row 15, but for some reason "LastRow" is being calculated to be 4. I'm having a similar error with LastCol
Blue skies!
Can someone please explain to me how the following statements work?
LastRow = ActiveSheet.UsedRange.Rows.Count
LastCol = ActiveSheet.UsedRange.Columns.Count
I thought what it does was went into the active sheet, scanned the cells for contents, and returned the highest row or column, respectively.
I've used it in several of my macro's and this is what seems to happen. However, I just wrote one now, where cells that contain contents start at row 12 and end at row 15, but for some reason "LastRow" is being calculated to be 4. I'm having a similar error with LastCol
Blue skies!