saracat2012
New Member
- Joined
- Jun 27, 2023
- Messages
- 11
- Office Version
- 365
- Platform
- Windows
I'm using a row counter to select all data in a column, but it's dropping a number of rows at the end. When I run the below macro, it returns the correct number:
Sub Count_Rows()
Range("b4").Select
lastrow = ActiveCell.CurrentRegion.Rows.Count
MsgBox (lastrow)
End Sub
However, when I run the next macro to select the cells in column B that have data, it's dropping several rows (3-5 that I've witnessed, depending on the spreadsheet). The next macro is:
Sub selectdata()
Range("b4").Select
lastrow = ActiveCell.CurrentRegion.Rows.Count
Range("b4:b" & lastrow).Select
End Sub
Do I have something incorrect?
TIA
Sub Count_Rows()
Range("b4").Select
lastrow = ActiveCell.CurrentRegion.Rows.Count
MsgBox (lastrow)
End Sub
However, when I run the next macro to select the cells in column B that have data, it's dropping several rows (3-5 that I've witnessed, depending on the spreadsheet). The next macro is:
Sub selectdata()
Range("b4").Select
lastrow = ActiveCell.CurrentRegion.Rows.Count
Range("b4:b" & lastrow).Select
End Sub
Do I have something incorrect?
TIA