Posts by Oracle2057

    Re: Help with this Formula/Code


    Filename needs to contain the directory path as well as the filename. For example in brackets needs to contain something like [C:\Test\20130516_XX_IR_Uploadfinal_V1.0_12062013.xls]. Just change your Filename variable to include the directory of the file or add a second varibale that contains it and add it to the code.


    Code
    link = "=INDIRECT(""[" & FilePath & Filename & "]" & sh & "!"" & RC[-1])"

    Re: Filter Per Selection From The Pull-down List


    Hello,


    You can use the code below and it should do what you are wanting. Now i added the for each loop at bottom to loop through each of the cells that are part of each filter. You can remove if you already have something otherwise this creates an array of the different possible times and then loops through each of the times and filters range for that time.


    Re: Trying to avoid GoTO - vba Loop containing Case


    Hello,


    You do not have to use the the GoTo statement. There are a number of different things you can do to avoid using GoTo but the first thing that comes to mind is to create a Boolean variable and just name it boolLoop or whatever you want then use it like i have in the code below and it will loop for you.


    Re: Getting rid of helper columns


    Hello,


    You could use something like the below formula. Please ensure that once you place the formula into the cell you must edit the cell then instead of pressing enter press Ctrl-Shift-Enter to change it to array formula. Also as a note WEEKNUM is not compatible with a header row (as it includes incompatible values for WEEKNUM function) which is why I did not do the entire column and used an actual range instead. If you included the header row you would get a #VALUE error.


    =SUM(IF((Queries!$F2:$F5000-Queries!$E2:$E5000>1),0,IF((WEEKNUM(Queries!$E2:$E5000+0)=A1),1,0)))

    Re: How to click website link in Excel VBA?


    Hello,


    I have attached a spreadsheet and basically it will loop through all links on a website. It will paste the link information into a spreadsheet so that you can see general information about the links just for informational purposes. I am not sure how your site looks or the source code on it so I am unable to give exact code but you should be able to get the idea of how its done in the code I provided. I use USPS.com site as an example of how my code works and basically it goes to USPS.com and then sifts through all links on the page until it finds the Terms of Service hyperlink and then clicks on that link. To adapt it to your website look at the source code and check if the link on your site has something that is always in that link. For instance the text on the website for that link always says like 'Daily Report' or something that you can loop through and find that value and if it does then click that link or check if there is a static start to the link path like its always 'https://usps.com/archive/pagenumber' then a number at the end and you can search for the static part of the string. Please let me know if you need more help.


    [ATTACH=CONFIG]54475[/ATTACH]

    Re: Selecting ID based on condition


    Hello,


    I believe the easiest way is to just use a formula. It should do what you are wanting. When you go to copy the formula into your new spreadsheet and change the lookup values remember the following to make this type of formula work. Always instead of pressing enter after modifying this cell formula press Ctrl-Shift-Enter and it will encase your formula in brackets which will make the formula work (FYI - This is called an Array Formula). Below is the formula and the spreadsheet showing this formula.


    {=IFERROR(INDEX($A$1:$A$15,MATCH(C2,IF($B$1:$B$15=2001,$C$1:$C$15),0)),INDEX($A$1:$A$15,MATCH(C2,IF($B$1:$B$15=1001,$C$1:$C$15),0)))}


    [ATTACH=CONFIG]54470[/ATTACH]

    Re: update information from one worksheet to another worksheet


    Hello,


    I understand I was thinking the formula was probably not going to be what you were looking for but it was easier:) .
    I have attached the spreadsheet or you can copy the macro below. Let me know if this was not what you were looking for or needed something else added.


    [ATTACH=CONFIG]54399[/ATTACH]


    Re: update information from one worksheet to another worksheet


    Hello,


    Check out the spreadsheet and tell me if that works for you. Now I used just a vlookup to get the data to the admin tab. When you type a work order # into the admin tab and it has a record on the dashboard tab then the data from the dashboard tab will update the admin tab. Now I was unsure whether you were looking for a code solution instead of a formula both are simple the formula method is in the attached spreadsheet. Now if you are going to be dealing with tens of thousands of records then I wouldn't suggest the formulas since they will consume memory if dealing with larger sets of data to calculate.


    [ATTACH=CONFIG]54398[/ATTACH]

    Re: Save File as Name plus Todays Date in text format using Macro


    Hello,


    I don't see anything in the code that would actually change the number format. The 2nd part with the date is very simple replace the saveas portion of your code with the code below and your set as far as that goes. If you manually saved the file as text and then opened it does the number format still change? If you have the field with an invalid number like that it should be read in as text anyway.


    Code
    ActiveWorkbook.SaveAs Filename:= _ 
        "[URL="file://\\Sadnl\dfsnl\GRNL01\1650\Werkgroepen\Migratie\Cashbreaks"]\\Sadnl\dfsnl\GRNL01\1650\Werkgroepen\Migratie\Cashbreaks[/URL] Fanta\Team Funds\Cash Transfers & Format(date, "dd-mm-yyyy") &.txt" _ 
        , FileFormat:=xlText, CreateBackup:=[COLOR=#0000ff]False[/COLOR]

    Re: Need Excel macro to get all combinations of a term


    Hello,


    I believe the attached spreadsheet or you can copy the code below will do what you are wanting. I am curious if by all combinations includes items in different orders. For example if we have in Cell A1, which is where the string is that I extract combinations from, we have 'Dog Bark Apple' would the total possible combinations be 6 or lets say we look at 'Dog Bark' then would you also count 'Bark Dog' since it is technically a different combination since the order is different. Check it out and let me know if you want it changed or not or if you have any questions.


    [ATTACH=CONFIG]54396[/ATTACH]


    Re: Clearing sheets from a list, except the first row


    Hello,


    Add the following line of code just before you perform the copy. Also always remember to wrap code when you place into the forumns so that it will be easier for us to read and paste into VBA editor


    Code
    Worksheets(MySh).Rows("2:" & Rows.Count).Delete Shift:=xlUp

    Re: Random shuffling of data in rows


    Hello,


    Try this spreadsheet or copy the code below into your code. If you look in the VBA editor at the tree view on the left hand side it shows all the worksheets, modules, classes, userforms for your project. If you select 'Workbook' from the tree view and paste the code there it will run on workbook open or you could just use the attached file. Fixed the loop went one too many times for the samples and the numbering now starts at 1 instead of 0 for both participants and samples.


    [ATTACH=CONFIG]54390[/ATTACH]


    Re: If cell contains "thisword" replace the entire cell with "thatword"


    Hello,


    The following code should do what you are wanting. Please let me know if this was not what you were looking for. Keep in mind this will search the entire spreadsheet for 'GE' so if a word in another cell contains 'GE' this would change that cells value like a name field on that spreadsheet with 'George' would change that field to 'GE BIO'. To fix that change the Set acell line with the code below and change the range to whatever is needed.


    VBA:

    Code
    Set aCell = Sheets("Sheet1").Range("A:A").Find(What:="GE", _
        LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
        MatchCase:=False, SearchFormat:=False)


    VBA:

    Re: Macro to find substring, insert row, move text from adjacent cell to new row


    Hello,


    The attached file contains a macro that should work for you. Also the code for the macro is below. Just change the reference to the Sheet name when you copy into your spreadsheet and you should be good to go. Please let me know if you were looking for something different.


    [ATTACH=CONFIG]54383[/ATTACH]


    VBA:

    Re: Random shuffling of data in rows


    Hello,


    The attached spreadsheet should have it built the way you are wanting. If you just want the code it is below. Let me know if this was not what you were looking for.


    [ATTACH=CONFIG]54370[/ATTACH]


    Re: Searching a folder for a keyword and returning the full path


    Hello,


    I have a question on how you would determine the subfolders and actual filename for the unique files you are wanting to attach. The below VBA, or you can open the attachment, will work for this but you will need to fill in the actual filename for the static file. I can update the VBA for navigating to the right subfolder and getting the actual filename for the unique file so it can be attached if you could tell me how, from the data provided via the spreadsheet, to navigate to the right subfolder and then how the filename is generated. For instance is the subfolder always the provider name on the spreadsheet and is the filename for the unique file contain the reference number?


    [ATTACH=CONFIG]54367[/ATTACH]


    Re: Copy rows to different sheet starting at a specific row.


    Hello,


    The offset at the end of this line of code determines where the paste will occur. For instance if you change Offset(1, 0) to
    Offset(0, 0) then the paste will occur at A1. Please let me know if you need any other help on this or you dont understand.