Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

excel macro ( VB )

  • 18-02-2010 11:45AM
    #1
    Registered Users, Registered Users 2 Posts: 268 ✭✭


    Hey all,

    looking to use a macro to split data from one large report into smaller groups on seperate sheets based on the data contained in the header colums.

    Ie Cut all accounts with a balance of over €50 and a description of actve to sheet two ( or name of sheet two ie barring )

    so i want to be able to define certain parameters for each split, do i need to write this in VB? or can it be done from the record macro part.

    Cheers


Comments

  • Registered Users, Registered Users 2 Posts: 1,077 ✭✭✭KAGY


    Hey all,

    looking to use a macro to split data from one large report into smaller groups on seperate sheets based on the data contained in the header colums.

    Ie Cut all accounts with a balance of over €50 and a description of actve to sheet two ( or name of sheet two ie barring )

    so i want to be able to define certain parameters for each split, do i need to write this in VB? or can it be done from the record macro part.

    Cheers

    Not 100% sure of what you are trying to acheive
    A simpler way may be to use a Pivot Table which analyses your date and creates a table showing summary values, e.g. account names down the side and balance in the main part of the table. you may need to add an extra column with if statements to create your categories. Check help and post back if you think that this would help.

    You could alway use a simple AutoFilter to show a subset of your data.

    Otherwise in VBA you would need to create a module something like this psuedo code (my VBA is very rusty)
    select Activesheet data range
    For each row in Range
        if Cell(row, 2) > 50 then         (if data is in column 2 i.e. B)
            Activesheet.Select.Rows(row).Copy
            SummarySheet = cell(row,1).value     (if sheet name is in col A)
            Range(sheets(SummarySheet).rows(end)+1).paste
        else if ...etc
        end if
    Next Row
    

    as I said, long time since I used VBA


Advertisement