Posts by Biz

    Re: Generate list from excel fields


    Quote from jindon;574831

    Use one of these


    Nice script


    Biz

    Dear All,


    Don't you hate when users save xlsm as xlsx by accident and macros disappear in Excel 2007 & 2010
    Why not force xlsm save only?


    Figured out VBA code that works.



    Biz

    Re: Formula To Locate Dates Within Financial Year And Provide Cumulative Total


    =SUMPRODUCT((array1=condition1)*(array2=condition2),(array3))
    which works as the '*' operator is only required to coerce the conditional arrays that resolve to TRUE/FALSE into numeric values
    (1/0). Thus, it is also possible to coerce each of the conditional arrays individually by multiplying them by 1


    Hope quick explaination above helps.


    Source http://www.xldynamic.com/source/xld.SUMPRODUCT.html#format


    Biz

    Re: Create a Custom Sort Order


    Hi Dave,


    Dynamic range is needed because if need new worksheets tabs are added then someone would have copy and paste new worksheets in Sort Order worksheet tab. The only reason I am trying to use dynamic range is to avoid someone manually changing the range in the code below


    Code
    With Worksheets("Sort Order").Range("A1:A79")

    .


    replaced with

    Code
    With Worksheets("Sort Order").Range("sheetsorder")


    With Range code with dyanmic range name fails. Not sure why it fails.
    Hopeful someone can help.


    Biz

    Re: Create a Custom Sort Order


    Quote from Dave Hawley

    Enter "Custom Sort" into the Excel help.


    No idea what your Worksheet tabs and "coincidence" have to with creating a custom sort order.


    Dave you are right! My only question is then if the code below works


    Code
    With Worksheets("Sort Order").Range("A1:A79")


    then why does the code fail with

    Code
    With Worksheets("Sort Order").Range("sheetsorder")


    I have created a dynamic range called sheetsorder. The only reason I am creating dynamic range if more worksheets are added to summary then I need to sort the worksheets accordingly.


    Biz

    Re: Loop with dynamic range name


    Quote from Dave Hawley

    You are re-inventing the wheel and a slow Wagon wheel at that. Excel's built in sort allows you to define a Custom Sort.


    Please stop assumming your means to an end in Thread Titles, it buries answers under misleading Titles.


    Code
    it does not work

    That is of no help to anyone trying to help you. Do you see the Doctor and say "I don't feel well" and nothing more?


    Hi Dave,


    You are correct to certain extent. I have lots worksheet tabs and summary tab. The way worksheet tabs are listed do not necessarily coincidence with Excel sorts that are available according to Summary tab. I have created a worksheet with worksheet tab names as per summary tab.


    Eg Petty Cash accounts starts with 38031 where as Revenue received in advance starts from 22500.


    Kind Regards,


    Biz

    Dear All,


    I am trying to create custom sort list. It works below when I define range as A1:A79.


    [VBA]Sub SortWS2()
    Dim SortOrder As Variant
    Dim sheetsorder As Range
    Dim Ndx As Long
    Application.ScreenUpdating = False
    With Worksheets("Sort Order").Range("A1:A79")
    For Ndx = .Cells.Count To 1 Step -1
    Worksheets(.Cells(Ndx).Value).Move before:=Worksheets(1)
    Next Ndx
    End With
    Application.ScreenUpdating = True
    End Sub
    [/VBA]


    I have created a dynamic range called sheetsorder. If I revise my code it does not work.


    [VBA]Sub SortWS2()
    Dim SortOrder As Variant
    Dim sheetsorder As Range
    Dim Ndx As Long
    Application.ScreenUpdating = False
    With Worksheets("Sort Order").Range("sheetsorder")
    For Ndx = .Cells.Count To 1 Step -1
    Worksheets(.Cells(Ndx).Value).Move before:=Worksheets(1)
    Next Ndx
    End With
    Application.ScreenUpdating = True
    End Sub
    [/VBA]


    I have attached my workbook for your review.


    Kind Regards


    Biz