none
This should be easy, I just need to open my excel doc at the top of the page, instead of near the bottom, but I can't figure out how?? RRS feed

  • Question

  • Hi Everyone,

    So like it says in the title, I have this excel sheet that runs some macros and then opens at the bottom of the page, instead of the top. It seems like this would be all over the place( how to fix it) but I can't find anything.

    Using excel 2013.

    I am using VBA, if that matters.


    Best regards, Mike


    • Edited by dzitam Thursday, August 11, 2016 3:07 PM
    Thursday, August 11, 2016 3:06 PM

Answers

All replies

  • Hi dzitam,

    to set position and height and width of the file that going to be open you can use the code below.

    you have to write the code in Workbook_Open() Event of the workbook which you want to open.

    Private Sub Workbook_Open()
    Application.Top = 0
    Application.Left = 400
    Application.Height = 400
    Application.Width = 400
    End Sub
    
     

    Following are the link of the descriptions of the properties that we had used in the code.

    Application.Top Property (Excel)

    Application.Left Property (Excel)

    Application.Height Property (Excel)

    Application.Width Property (Excel)

    you can modify the size as per your requirement.

    from the code mentioned above you will get output like below.

    Regards

    Deepak


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, August 12, 2016 6:32 AM
    Moderator
  • Hi Deepak,

    So I am not trying to open the window at a certain height or width, I simply want to have it open at the top of the excel doc, instead of halfway down the page, does that make sense?


    Best regards, Mike

    Friday, August 12, 2016 2:19 PM
  • If you mean you want to select and view cell A1 on some sheet adapt the following

    Application.Goto ThisWorkbook.Worksheets("Sheet1").Range("A1"), True

    If you don't want to change the active cell first ensure your workbook and required sheet are active then

    ActiveWindow.ScrollIntoView 0, 0, 0, 0

    Friday, August 12, 2016 4:06 PM
    Moderator
  • Hi Peter, Yup, that worked.

    Thanks a lot for your help with this. I know it seems like a little thing, but my google-fu was failing me big time.I marked your answer as correct!


    Best regards, Mike

    Friday, August 12, 2016 4:10 PM