Brian.Crawford
Board Regular
- Joined
- Oct 3, 2007
- Messages
- 136
I have the following section of code from a SUB that needs to know the last row with data in it.
.
Dim RwCount as long, RRng as range
.
.
With Sheets("annualsummary")
Set RRng = .Range("D:D")
RwCount = RRng.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
.
.
When the code is executed during normal VBA macro execution the RwCount is returned =0. When I step through the code with the debugger I get the correct answer of 171. I use this last row method extensively in my macros and up until a week ago it has always worked. I have only seen this problem in this particular SUB/macro.
The following setting are in place (and have been all along)
Calculation is set to manual
EnableEvents is false
ScreenUpdating is false
Any advice is much appreciated.
Brian
.
Dim RwCount as long, RRng as range
.
.
With Sheets("annualsummary")
Set RRng = .Range("D:D")
RwCount = RRng.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
.
.
When the code is executed during normal VBA macro execution the RwCount is returned =0. When I step through the code with the debugger I get the correct answer of 171. I use this last row method extensively in my macros and up until a week ago it has always worked. I have only seen this problem in this particular SUB/macro.
The following setting are in place (and have been all along)
Calculation is set to manual
EnableEvents is false
ScreenUpdating is false
Any advice is much appreciated.
Brian