Posts by Richie(UK)

    Re: Counting number of dates with specific month


    Hi and welcome to the forum.


    Another possiblity is to use the AutoFilter with 'Greater than or equal' for 01/06/2012 And 'Less than or equal' for 30/06/2012 and =Subtotal(2,YourRange) for the count of items. You can also then see which items are included.


    PS: Nice formula AAE. The -- part, that coerces a boolean to a number right?

    Re: Extracting data from a directory of XLSM's


    Quote from entilza;616959

    Found the problem. The line of code needs "set" to proceed the rest of it. ...


    Told you to check it - well spotted! :)


    As regards running the macros, what security level do you have set?

    Re: Dynamic .RANGE code (fixed columns, unknown rows) for VBA


    Sorry, but even with the example workbook I'm still not clear. For example, you have Q2:Q3 as the criteria range but these cells are blank.


    You said that the dynamic part was what you were struggling with. Well, the code above (reproduced below) covers that part. For the remainder I suggest that you use the Macro Recorder to record what you actually want to achieve and then modify the code accordingly. Post back if you are still having problems.


    Code
    .Range("A2:N" & .Cells(Rows.Count, "N").End(xlUp).Row).AdvancedFilter

    Re: Dynamic .RANGE code (fixed columns, unknown rows) for VBA


    Hi,


    Only taken a quick look but is this closer to what you want:


    Code
    Sub Filter()
         
        With Sheets("May 2012")
            .Range("A2:N" & .Cells(Rows.Count, "N").End(xlUp).Row).AdvancedFilter Action:=xlFilterCopy, _
                CriteriaRange:=.Range("Q2:Q3"), CopyToRange:=.Range("A2:F2"), Unique:=False
        End With
        
    End Sub

    Re: Extracting data from a directory of XLSM's


    Hi and welcome to the forum (and well done for making such a clear first post).


    I've only looked at this quickly as I'm just about to go out (ie check it carefully!) but I would have thought something like this:


    Re: Macro copy first row on sheet and paste everything on active row.


    Hi,


    Perhaps I'm missing something but isn't it just a matter of combining the two routines that you have like this:


    Code
    Sub CopyrowCombined()
        Rows("1:1").Copy
        ActiveCell.EntireRow.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
            False, Transpose:=False
        Application.CutCopyMode = False
    End Sub

    Re: Macro button delete


    Hi and welcome to the forum.


    Please remember to always use code tgas when posting code to the forum (as you agreed to do when you joined). I've added them for you this time.

    Re: Uploading a spreadsheet onto another Exc. Spreasheet Automatically?


    Hi,


    Yes, this is possible. I'm not sure that I understand what you want to do with the data in csv file so you will have to add some further code but the general structure could be something like this:


    Re: For Loop/While Loop to copy and paste workbooks into worksheets


    Hi,


    One way of doing this would be to make an array of the names that you want to work with. Something like this, for example.



    You can either call your existing routine and pass the name as an argument or simply incorporate the loop within the existing routine.

    Re: Workbook_WindowDeactivate not triggered when changing applications


    Hi Aidan,


    I haven't actually done what you are trying to achieve but it strikes me that if it is possible it's likely to be by use of Application-level events. Are you familiar with those? There is plenty of info on the Web but two good starting points would be:


    http://cpearson.com/excel/AppEvent.aspx


    http://www.tushar-mehta.com/excel/vba/vba-XL%20events.htm