ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Right Hand Column on Screen (https://www.excelbanter.com/excel-programming/282055-right-hand-column-screen.html)

Tim Childs[_6_]

Right Hand Column on Screen
 
Hi

Can someone give me the code snippet to give the column
number of the the column which is at the far right of the
screen itself i.e. the returned result will change if the
zoom factor of the display is changed.

Thanks

Tim

Chip Pearson

Right Hand Column on Screen
 
Tim,

Try something like the following

With ActiveWindow.VisibleRange
MsgBox .Cells(.Cells.Count).Column
End With


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Tim Childs" wrote in message
...
Hi

Can someone give me the code snippet to give the column
number of the the column which is at the far right of the
screen itself i.e. the returned result will change if the
zoom factor of the display is changed.

Thanks

Tim




Tom Ogilvy

Right Hand Column on Screen
 
Sub FindColumn()
Dim rng As Range
Set rng = ActiveWindow.VisibleRange
Set rng = rng.Columns(rng.Columns.Count)
MsgBox rng.Address
End Sub


--
Regards,
Tom Ogilvy

"Tim Childs" wrote in message
...
Hi

Can someone give me the code snippet to give the column
number of the the column which is at the far right of the
screen itself i.e. the returned result will change if the
zoom factor of the display is changed.

Thanks

Tim




Tim Childs[_6_]

Right Hand Column on Screen
 
Chip

just the ticket, brilliant as usual!
thanks

Tim

-----Original Message-----
Tim,

Try something like the following

With ActiveWindow.VisibleRange
MsgBox .Cells(.Cells.Count).Column
End With


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




All times are GMT +1. The time now is 02:56 PM.

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