Posts by Staging2000

    Re: zoom widow to a selected range


    Thanks for adding vba code tags. Still learning forum guidlines.


    Thanks for the code suggestion. Although the custom view seems start with the correct selected column it seems to just remember the zoom level at time the view was saved. So if the macro is run when the app window is a different size or if the monitor resolution is different then the result is not correct. (however it does do it while events are enabled) :)

    I also want this macro to run on application resize. I understand the application resize procedure so what I am trying to achieve is to resize to Columns G to M so that is what the user sees under all situations.

    I guess I can disable events, run my macro and re enable events. I'm just on a mission to do this with as few lines of code as possible. In the past few days I have managed to cut most of my macros in half. It's kind of my way to gain knowledge of vba. Try, Try and Try again!

    So although I can use my current project, I'd still like to find an answer and if I do figure it out I'll certainly reply here.



    VBA newbie here (but learning quickly)

    I am trying to zoom to a set of columns. (say G:M)

    I am aware of:
    Columns ("G:M").Select
    ActiveWindow.Zoom = True
    But I am trying to do it without actually using the 'select' command. Let me explain:

    I have a worksheet that has the Worksheet_SelectionChange function and I am trying to have most of my code execute without having to disable Application.EnableEvents every time I want to do something. I am able to change cell vaues and properties without actually 'selecting' the cells i.e. :
    Range ("H9").Value = "hello"
    Range("H9").Interior.ColorIndex = 8
    If I use the Select command then one of my functions forces the acive cell to column "A" and overrides the zoom area that I want. If Anyone can tell me how to zoom to a set of columns without having to disable events first it would be greatly appreciated.