+ Reply to Thread
Results 1 to 12 of 12

Replace Fill Down, Complicated Equation

  1. #1
    Registered User
    Join Date
    09-14-2011
    Location
    London
    MS-Off Ver
    Mac Office 2011
    Posts
    62

    Replace Fill Down, Complicated Equation

    I have an equation in H1 ie "=HYPERLINK(CONCATENATE("file:///\\uranus\dckgen\Brands\Zoom\Brand - Zoom\Upload Photos\2012\week",B1,"\BHS_WK",B1,"_LR\",E1,".jpg"))"

    I want to fill down as far as Column B AND OR E is filled out.

    Initially I was selecting A so that the whole column was selected and then edit > Fill down.

    This method starts to make the sheet very large.

    How can I can write a macro that will do this? I would need to work on some sheets and not others. So sheet2 sheet4 sheet 9 etc.

    it would also need to automatically happen as opposed to a button to run the macro.
    This is a version of the code I have from jraj1106

    Please Login or Register  to view this content.
    Once I have this working, how might I add it to individual sheets so that it happens my default with no need to press buttons.

    Many Thanks

    Matt

  2. #2
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Simple Macro Req. to replace Fill Down COMPLICATED EQUATION

    Hello there,

    Could you attach a sample of your workbook?

    Thanks!

  3. #3
    Registered User
    Join Date
    09-14-2011
    Location
    London
    MS-Off Ver
    Mac Office 2011
    Posts
    62

    Re: Simple Macro Req. to replace Fill Down COMPLICATED EQUATION

    Wouldn't upload to big, here it is below

    http://wtrns.fr/aYAz503ozFTw4B

  4. #4
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Simple Macro Req. to replace Fill Down COMPLICATED EQUATION

    Alrighty try the below code:

    Please Login or Register  to view this content.
    To insert the code follow the below steps

    1. Open VBA (Alt+F11)
    2. In the Project Explorer on the far left (if not there press Ctrl+R) double click on This
    Workbook.
    3. Paste the above code here. Anything that appears in green is a comment to help you
    understand the code.
    4. Exit out of VBA

    The code is set to run whenever you select a worksheet.

    Let me know if this works for you or if you have any questions.

    Thanks!

  5. #5
    Registered User
    Join Date
    09-14-2011
    Location
    London
    MS-Off Ver
    Mac Office 2011
    Posts
    62

    Re: Simple Macro Req. to replace Fill Down COMPLICATED EQUATION

    The code is set to run whenever you select a worksheet.
    I haven't run the code as yet but I notice that you mentioned the above. The only thing is, that sheet will never be viewed (referenced but not viewed directly)

    They way the sheet works at the moment is that the data is pasted into BHS then the submitted button clicked (this outputs a CSV) then pastes it on to the bottom of the list in BHSDB. Maybe I should be running the macro from the end of that macro so that it does the fill down?

    Also on the complete sheet there are many other sheets.

    Just going to experiment with the little knowledge that I have.

    Many Thanks so FAR!!!

  6. #6
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: Simple Macro Req. to replace Fill Down COMPLICATED EQUATION

    Another option. You haven't stated what you want to trigger the macro running so I haven't put any autorun in the program.
    Please Login or Register  to view this content.
    Last edited by WasWodge; 06-13-2012 at 01:26 PM.
    If my solution worked (or not) please let me know. If your question is answered then please remember to mark it solved

    Computers are like air conditioners. They work fine until you start opening windows. ~Author Unknown

  7. #7
    Registered User
    Join Date
    09-14-2011
    Location
    London
    MS-Off Ver
    Mac Office 2011
    Posts
    62

    Re: Simple Macro Req. to replace Fill Down COMPLICATED EQUATION

    I altered it to cover the exact sheets named, and I get a compile error.

    I changed the line
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    Last edited by Paul; 06-14-2012 at 04:57 AM. Reason: Changed QUOTE tags to CODE tags.

  8. #8
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: Replace Fill Down, Complicated Equation

    Only thing I can think of is there is either a spelling mistake or there are leading/trailing spaces in your sheetnames. Run macro bbb in the attached workbook, It runs as intended for the 4 out of 5 sheets it is supposed to.
    Attached Files Attached Files

  9. #9
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: Replace Fill Down, Complicated Equation

    I am going to be out for a few hours. Try running this to see if it helps. Please note that you need a sheet called "Sheet1"

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    09-14-2011
    Location
    London
    MS-Off Ver
    Mac Office 2011
    Posts
    62

    Re: Replace Fill Down, Complicated Equation

    I've uploaded the sheet i am working on here

    I noticed that as soon as anything gets added it plays up I can only assume its active on all work sheets or its effect by other Macros that I have running.

    The Fill we are trying to run here is to run on all the sheets ending in DB (Database)

    The way it works at the moment is that code gets pasted into a sheet without a DB so BHS and then a click of the submit adds it to the database on BHSDB its here I am trying to achieve the fill down.

    I'll take other pointers if you know anyway in which I might be able to get the file size down.

  11. #11
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: Replace Fill Down, Complicated Equation

    A) you didn't have the sub named and you had End and not End Sub
    B) in the attached workbook I have taken out your modules and commented out the code in ThisWorkbook
    C) in the sheets you didn't have anything in Column B and so the code wouldn't fill in anything
    D) the code in ThisWorkbook definitely stops the code running
    E) the code runs with your codes removed /commented out
    F) afraid I don't have the time to plough through your codes to work out what is interfering with the code or not
    Attached Files Attached Files

  12. #12
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: Replace Fill Down, Complicated Equation

    Try the attached after a couple of adjustments
    Attached Files Attached Files
    Last edited by WasWodge; 06-15-2012 at 11:58 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1