Posts by Craig Ottley

    Re: Force Page Breaks In Vba?


    Ok try this



    should help you get there

    Re: Force Page Breaks In Vba?


    For some reason in excel the FitToPageWide and tall doesn't work when put into a macro so there is not point in setting FitToPageWide = 2


    try doing something along the lines of this

    Code
    With ActiveSheet.PageSetup
            .CenterHorizontally = True
            .Orientation = xlLandscape
           
        End With
        
        ActiveWindow.View = xlPageBreakPreview
        ActiveSheet.VPageBreaks(1).DragOff Direction:=xlToRight, RegionIndex:=1
        ActiveWindow.View = xlNormalView

    Re: Matrix Combinations And Permutations


    With a bit of Mod i've got the finished article!


    Thanks you very much Ger Plante


    Re: Matrix Combinations And Permutations



    yeah thats right. it doesn't matter about children/infants being in there own room... i can get adults and children working fine its the in-between bits i can't get to work


    IE 3 adults 1 child and 1 infant

    Re: Matrix Combinations And Permutations



    Infants is the same as Children but they have there own seperate field as they are counted in the occupancy...


    so maximum number of Infants in a room is 5 (no adults)
    maximum number of Children in a room is 5 (no adults)


    maximum number of Adults in a room is 3


    the room can hold a maximum of 5 occupancies


    therefore if there are 3 adults in the room only 2 children or two infants are allowed in the room...


    i've attached a sheet to hopefully show what i mean


    zimitry

    Re: Run Macro From An "if" Formula In A Cell


    Hmmm strange...


    Copy and paste the below code into the worksheet Object



    This works fine on mine, please see attachment for details..


    zimitry

    This isn't an easy one for me... so here it goes on trying to explain...


    i've got 2 numeric numbers one in each cell. These numbers indicate Maximum occupancies for a hotel room...


    Maximum Adults Maxmium Occ
    3 5


    The Occupancy table looks like this


    Adults Children Infants... so taking the above numbers the table should be built up like this


    Adults Children Infants
    1 0 0
    2 0 0
    3 0 0
    1 1 0
    1 2 0
    1 3 0
    1 4 0
    1 1 1
    1 1 2
    1 1 3


    3 2 0
    3 0 2
    3 1 1


    etc...


    so basically to room can have a maxium of 3 adults and 2 children equaling the maxium room occupancy.


    i'm trying to create a function that will automatically do this and workout subsquent numbers below the maxmium but i can't get anywhere near the result i am looking for...


    any help is much appreciated


    Cheers


    zimitry

    Re: Run Macro From An "if" Formula In A Cell


    There is a way of doing this but not directly from an if formula..


    in Visual Basis editor double click on your worksheet then in the main window on the left hand mousedown select Worksheet. then on the Right hand mousedown select Change. Now you can insert code to test the cell that has the IF formula



    Make your if formula return a value to test IE


    =IF(H14>J14,1,"")


    Hope this helps


    zimitry: D