ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Basic VBA Question with Array (https://www.excelbanter.com/excel-programming/366042-basic-vba-question-array.html)

SITCFanTN

Basic VBA Question with Array
 
I have a workbook with a dozen or so sheets. I'd like to add code to my
existing macro to state when the sheet tab is clicked, the sheet displays at
the bottom of the page, not the top. The reason for this is each of the
sheets has a total at the bottom of the page and I'd like to be able to view
that immediately. I can't specific a specific cell because I download a
report each day so the last row of each sheet varies each day. I'm thinking
this is simple, but I haven't been able to figure it out yet. Thanks for your
help.

Steve Yandl

Basic VBA Question with Array
 
I'm not sure you will find it simple to add code to your existing macro to
get what you want but you could add code to the workbook that would do what
I think you want.

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim intRowCnt As Integer
intRowCnt = ActiveSheet.UsedRange.Rows.Count
ActiveSheet.Cells(intRowCnt, 1).Select
End Sub



Steve Yandl



"SITCFanTN" wrote in message
...
I have a workbook with a dozen or so sheets. I'd like to add code to my
existing macro to state when the sheet tab is clicked, the sheet displays
at
the bottom of the page, not the top. The reason for this is each of the
sheets has a total at the bottom of the page and I'd like to be able to
view
that immediately. I can't specific a specific cell because I download a
report each day so the last row of each sheet varies each day. I'm
thinking
this is simple, but I haven't been able to figure it out yet. Thanks for
your
help.




lcoreyl[_32_]

Basic VBA Question with Array
 

try
Cells.SpecialCells(xlCellTypeLastCell).Activate


--
lcoreyl
------------------------------------------------------------------------
lcoreyl's Profile: http://www.excelforum.com/member.php...fo&userid=2042
View this thread: http://www.excelforum.com/showthread...hreadid=557591


SITCFanTN

Basic VBA Question with Array
 
THanks Steve, this works great, I added it to the bottom of each sheets page
setup sub. I appreciate your help, thank you and have a great holiday.

"Steve Yandl" wrote:

I'm not sure you will find it simple to add code to your existing macro to
get what you want but you could add code to the workbook that would do what
I think you want.

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim intRowCnt As Integer
intRowCnt = ActiveSheet.UsedRange.Rows.Count
ActiveSheet.Cells(intRowCnt, 1).Select
End Sub



Steve Yandl



"SITCFanTN" wrote in message
...
I have a workbook with a dozen or so sheets. I'd like to add code to my
existing macro to state when the sheet tab is clicked, the sheet displays
at
the bottom of the page, not the top. The reason for this is each of the
sheets has a total at the bottom of the page and I'd like to be able to
view
that immediately. I can't specific a specific cell because I download a
report each day so the last row of each sheet varies each day. I'm
thinking
this is simple, but I haven't been able to figure it out yet. Thanks for
your
help.






All times are GMT +1. The time now is 12:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com