问题
Using VBA in Excel 2013. I would like to position the active worksheet with a specific cell (eg "X25") in the upper left corner. I have tried selecting cells off the currently displayed area, .Select ("ZZ200"), and then reselecting my target cell. I don't seem to be able to control where the target cell is positioned. Suggestions
回答1:
Try this:
Application.Goto Range("X25"), Scroll:=True
This article has more information and options that you might find helpful:
https://msdn.microsoft.com/en-us/library/office/ff839232.aspx
回答2:
Try this. I actually got most of this code using the "record macro" feature. it's a pretty handy tool when you don't know how to do something
my_cell = "ZZ2200" 'change this to whatever you need
cell_row = Range(my_cell).Row
cell_col = Range(my_cell).Column
'moves to the top left corner
ActiveWindow.SmallScroll ToRight:=-9999
ActiveWindow.SmallScroll Up:=-99999
'moves to your active cell
ActiveWindow.ScrollRow = cell_row
ActiveWindow.ScrollColumn = cell_col
'selects your cell
Range(my_cell).Select
来源:https://stackoverflow.com/questions/29307782/positioning-an-excel-display-using-vba