View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
RB Smissaert RB Smissaert is offline
external usenet poster
 
Posts: 2,452
Default Push range against right screen edge

Trying to figure out a way to push a selected range against the right edge
of the screen by inreasing the width of column A.
It thought a loop like this would do it:

Do Until lRangeRightCol _
rngVis.Cells(rngVis.Cells(1).Row, _
rngVis.Columns.count).Column
Columns(1).ColumnWidth = Columns(1).ColumnWidth + 1
Set rngVis = ActiveWindow.VisibleRange
DoEvents
Loop

Where lRangeRightCol is the right-most column of this range.
However it doesn't work. Column A gets wider and wider, but the loop doesn't
exit.
Updating the screen doesn't help or more precisely doing
Application.ScreenUpdating = True
doesn't update the screen and maybe that is the trouble.

Any suggestions how to do this?

RBS