ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to Move Selected Cell to Top of Screen (https://www.excelbanter.com/excel-programming/315278-re-macro-move-selected-cell-top-screen.html)

Celtic_Avenger[_52_]

Macro to Move Selected Cell to Top of Screen
 

Once you have detemined the cell that contains the data your looking
for, I found the following

Application.Goto Reference:=Worksheets("Sheet1").Range("B15"),
Scroll:=True,

The only problem with this is that it scrolls down and also to the
right.


I have used cell B15 as the target cell in the above script,

what I think then needs to be done is that if the data you want is in
cell B15, you need to tell the code to scroll to A15 not B15, then it
wont scroll to the right.

so the final code would be

Application.Goto Reference:=Worksheets("Sheet1").Range("A15"),
Scroll:=True


.................................................. ...



Thought about this for five mins.........

What you could do is............Copy the contents of the cells in the
middle of the screen to a new inserted hidden column in "A" possition
in the worksheet.

Then use your search to look for the data in that column not in the
column in the middle of the page, then use the GOTO reference command
above to scroll down to that line......your code will find data in a
hidden column. This way you could use

Application.Goto Reference:=Worksheets("Sheet1").Range("A15"),
Scroll:=True

to goto you desired line.


I think this might work.....I'm no professional....but I think it may
work....it worked on a test file I created.


Celtic_Avenger


--
Celtic_Avenger
------------------------------------------------------------------------
Celtic_Avenger's Profile: http://www.excelforum.com/member.php...o&userid=14101
View this thread: http://www.excelforum.com/showthread...hreadid=273904



All times are GMT +1. The time now is 10:07 AM.

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