Posts by ir121973

    Re: VBA Save From Hyperlink


    Hi, I just wondered whether someone may be able to help me please with this so that I can finish my work project.


    Many thanks and kind regards


    Chris

    Hi, I wonder whether someone could help me please.


    I've put together this code with help from an online tutorial which fetches a list files from a given folder and creates a list of these on a Excel sheet with a link against each which allows the user to open a file.



    The problem I'm having is that I need to change this so that rather than opening the file, the link allows the user to save the file to a folder of their choice.


    But I've been working on this for well over a week now without any success.


    I've tried using the command 'Application.Dialogs(xlDialogSaveAs).Show' which I'd hoped would worked but this doesn't. I've attached a sample file which shows a list of files as the user would see this,



    • To use your own data you will need to change the file path in the 'btnFetchFiles' sub routine.
    • Then select the checkbox 'Select All Types of Files' and click the button next to it.


    I just wondered whether someone could possibly look at this please and let me know where I've gone wrong.


    Many thanks and kind regards


    Chris

    Re: VBA Open a Specific File Type


    Hi MrRedli, thank you for taking the time to read my post and for coming back to me with this.


    Unfortunately though, although I'm not receiving any error message this still lists all the files rather than just the .dat files.


    Many thanks and kind regards


    Chris

    Hi, I wonder whether someone could help me please.


    I'm trying to use the code below to open a specific file type, in this case '.dat'.



    The problem I have is that although the script runs, it's showing all the file types rather than the '.dat' files I want to show.


    Could someone perhaps tell me where I've gone wrong.


    Many thanks and kind regards


    Chris

    Hi, I wonder whether someone may be able to help me please.


    From the research I've carried out I've found many examples of creating a vb script using specific screen co-ordinates to find a specific point on a screen and click on this, in my case the close window button.


    But could someone tell me please is it possible to construct a script which finds the 'close' button and clicks on this each time even if the screen resolution changes and hence, the screen co-ordinates have changed.


    Any help would be gratefully received.


    Many thanks and kind regards


    Chris

    Hi, I wonder whether someone may be able to help me please.



    I'm using the script below to extract data from a master "All Data" sheet to multiple 'Destination' sheets, pasting the extracted data on selected rows for each of the sheets


    I have to admit I've put this together from several scripts I used, and despite the fact that it works, it's incredibly slow.




    I've been researching 'Select Case' statements over the past few days, but all of the tutorials and examples seem very basic in comparison to what I'm trying to achieve, so I'm very unsure how I can improve this.


    I just wondered whether someone could possibly look at this and offer some guidance on how I may go about correcting this problem.


    Many thanks and kind regards


    Chris

    Hi, I wonder whether someone could help me please.


    I'm using the code below to select a range to copy from a 'Source' sheet to the next blank row on the 'Destination' sheet.



    Although the code runs without an error message being created, the data is paste at the top of the 'Destination' sheet, overwriting the existing data, instead of pasting it to the next blank row.


    I've spent all day on this and read and tried multiple examples and tutorials without success.


    I just wondered whether someone may be able to look at this please and let me know where I've gone wrong.


    Many thanks and kind regards

    Hi, I wonder whether someone could help me please.


    I'm using the code to compare two columns on two separate sheets, and where there is a match copy data from each row to the 'Destination' sheet.


    To be more precise:


    • Use column D on the "All Resources" (Source sheet) sheet to compare against column E on the the "All Data" (Destination) sheet then
    • Search and column G on the 'Source' sheet and of a value is found store this as the 'Dn' value, then
    • Search column M on the 'Destination' sheet and if a value is present store this value, then
    • If a match is found between both sheets paste the data from column H to column H on the 'Destination' sheet.



    The code works fine, but I'm having a little difficulty with making the change.


    What I'd like to do is amend this section of code:



    Code
    If Dic.exists(Dn & Dn.Offset(, 8)) Then
                'Where the values stored in the 'Dictionary' variable match, the values from column H are copied and paste into column H on the 'Destination' sheet.
                'The first offset is the 'Destination' sheet i.e. 3 columns from column E.
                'The middle offset is the value being checked in column M i.e. 8 columns from column E on the Destination' sheet.
                'The last offset is the 'Source' sheet i.e. 4 columns from column d.
                Dn.Offset(, 3).Value = Dic.Item(Dn & Dn.Offset(, 8)).Offset(, 4).Value
     End If


    so that instead of using Offset(,8)), the code searches a specific cell, in this case cell B3.


    I've tried making the following changes, and although the code runs, the value are not being paste into the 'Destination' sheet.


    If Dic exsits((Dn.Range("B3")) then


    Dn.Offset(, 3).Value = Dic.Item(Dn.Range("B3")).Offset(, 4).Value


    I just wondered whether someone could possibly look at this please and let me know where I'm going wrong.


    Many thanks and kind regards


    Chris

    Hi, I wonder whether someone could help me please.


    Using a solution from @AB33 from a post I made here: http://www.excelforum.com/exce…atch-column-headings.html, I've been able to put together a script which sums specific figures if a date field matches a column heading.


    In a live environment, I've also been able to make some changes to this line,

    Code
    If a(i, 2) = "C&R" Then

    to take account of additional filters I want to apply to the data extracted from the 'Source' to the 'Destination' sheets.


    I've now come across another hurdle, which I'm afraid my knowledge, or lack of it has led me to hear.


    What I'm trying to achieve is as follows:



    • Rather than totalling the figures from Column E on the "In Flight Projects" (Source) sheet, where the value in Column D matches the column headers on "Output" (Destination) sheet,
    • I would, if at all possible please, total the figures from Column E on the "In Flight Projects" sheet where the value in Column B on the "In Flight Projects" sheet matches the rows in Column B on the "Output" sheet.


    I just wondered whether someone could possibly look at this please and offer some guidance on how I may achieve this.


    I appreciate that my description may not be the most straight forward, so I have placed a file here: https://www.dropbox.com/s/k6ox…%20Categories%20Test2.xls



    • The "In Flight Projects" sheet contains the raw data.
    • The "Desired Output" sheet illustrates how I'd like the final results to look, and
    • The "Output" sheet is being used to test the code.

    Re: VBA Count Unique Values


    Hi Kenneth Hobson, thank you for taking the time to reply to my post.


    Unfortunately I'm unable to post the file because of it's confidential content, but if you say that the logic is correct, I'll have a look at this again to make sure the logic matches the requirements.


    Thank you also for the tip.


    All the best and kind regards