John in HK


I'm writing a routine to process a series of tables with user input.

The user needs to be able to see the table, as well as the UserForm which gets his input, so I need to move the window so that a particular cell is at the top left hand corner of the window - is there a way to do this in VBA

Thanks




Re: Position a Cell at the top left conrner of the window

Keithyboy1


Here's how I would do it. In my example, I want cell J17 to appear in the top left corner. You then set the ScrollRow and ScrollColumn properties of the ActiveWindow object to equal the row and column properties of cell J17


ActiveWindow.ScrollRow = Range("J17").Row
ActiveWindow.ScrollColumn = Range("J17").Column






Re: Position a Cell at the top left conrner of the window

John in HK

Perfect - worked first time - thanks very much !




Re: Position a Cell at the top left conrner of the window

Andy Pope

Another way is to use the GoTo method with scroll being true.

application.Goto range("J17"),true