+ Reply to Thread
Results 1 to 12 of 12

Replacing Formulas with Code

  1. #1
    Valued Forum Contributor
    Join Date
    04-21-2005
    Location
    Southern England
    MS-Off Ver
    Excel for Office 365
    Posts
    1,689

    Replacing Formulas with Code

    Hi,

    I have a problem with a report I am converting from PDF to Excel.

    The problem is, it doesnt recognise certain data correctly and as a result columns are merged which distorts the data.

    In the attached I have shown the orignal report in columns A:H along with what I need in J:Q. I have used formulas for this but ideally would I would like is a code that would work and do this for me, can anyone help please?

    One thing to note is that I wouldnt want the data in column J:Q - I would like it to replace the orignal data table A:H

    Please note in my data i have manually inputted the sub totals manually - ideally I would like the code to do this. A similar code was supplied on a different post for this here (I just need to work out how it works)
    HTML Code: 
    Any suggestions are very much welcomed.
    Attached Files Attached Files

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Replacing Formulas with Code

    Hi Paul

    This Code in the attached appears to handle all but the Sub Totals. I can't make sense of where you've placed Sub Totals. Please explain the logic of the Sub Totals and I'll look at it.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Valued Forum Contributor
    Join Date
    04-21-2005
    Location
    Southern England
    MS-Off Ver
    Excel for Office 365
    Posts
    1,689

    Re: Replacing Formulas with Code

    Hi John

    Thanks for looking into this for me.

    The code doesnt work from row 20 down. What I need is the values shifted accross one column to the right and then in column B for it to strip out the customer name excluding the first two digits.

    Also, could it be applied to the orignal sheet (active sheet)?

    Regarding the sub totals:
    What I would like a code to do is look in column A for the words “sub total” and if found I would like it to sum the rows above until if finds the previous subtotal. The columns range is C:H

    Then if it finds “Net Settlement Total” I would like it to sum all the sub totals just generated (above)

    Does that help?

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Replacing Formulas with Code

    Hi Paul

    Where will I find this, Column A? It does not appear in your Sample File.
    “Net Settlement Total”

  5. #5
    Valued Forum Contributor
    Join Date
    04-21-2005
    Location
    Southern England
    MS-Off Ver
    Excel for Office 365
    Posts
    1,689

    Re: Replacing Formulas with Code

    Hi John

    This was missed on the sample upload. I have now included it along with the desired results

    Paul
    Attached Files Attached Files

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Replacing Formulas with Code

    Hi Paul

    When you say this
    could it be applied to the original sheet (active sheet)?
    Do you mean you wish to see "Old" and "New" on the SAME Sheet or should the Code be run on Columns A through H?

  7. #7
    Valued Forum Contributor
    Join Date
    04-21-2005
    Location
    Southern England
    MS-Off Ver
    Excel for Office 365
    Posts
    1,689

    Re: Replacing Formulas with Code

    Hi,

    It should be run through columns A to H (the new part is only for reference of what I am trying to achieve in cells A:H).

    Regarding the same sheet I see some codes take the oringal sheet and then make the amendments to the new sheet however I would like it applied to the original sheet.

  8. #8
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Replacing Formulas with Code

    Hi Paul

    Try the Code in the attached. CTRL + x will fire the Code on Worksheet APPO24.

    Sheet1 is included for testing only and can be deleted. Let me know of issues.
    Attached Files Attached Files

  9. #9
    Valued Forum Contributor
    Join Date
    04-21-2005
    Location
    Southern England
    MS-Off Ver
    Excel for Office 365
    Posts
    1,689

    Re: Replacing Formulas with Code

    Hi Jaslake

    I have only just seen your reply, normally I rely on a notifcation which I didnt recieve.

    This is great!! So far so good but will test fully

  10. #10
    Valued Forum Contributor
    Join Date
    04-21-2005
    Location
    Southern England
    MS-Off Ver
    Excel for Office 365
    Posts
    1,689

    Re: Replacing Formulas with Code

    Hi,

    It does indeed work great for the dummy data but not for my actual template but I think it will work with a couple of tweeks.

    Is there any way after the current code is run it could delete the rows (after row 20) if:
    • Row is blank
    • Row contains (exactly in column A) "App024", ,"Retail, "Excel VAT", "Business", "Inter", "Period", "Code", "Page", "End"


    I think the code for the above is similar to this below (cut from a previous code) :

    Please Login or Register  to view this content.
    Then I would need the header rows inputted and formatted:
    Please Login or Register  to view this content.
    Can you help in combining all codes please?
    Attached Files Attached Files

  11. #11
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Replacing Formulas with Code

    Hi Paul

    Please attach a File that includes ALL the Code you reference here; that will help me understand a bit better what you're trying to do.
    the code for the above is similar to this below (cut from a previous code)
    It seems to me that these Code additions will need to be run BEFORE the current Code, not after
    after the current code is run it could delete the rows (after row 20) if:
    Row is blank
    Row contains (exactly in column A) "App024", ,"Retail, "Excel VAT", "Business", "Inter", "Period", "Code", "Page", "End"
    This does not appear in your most current File
    “Net Settlement Total”
    but "Grand total" does...so, which is it, or could it be either?

  12. #12
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Replacing Formulas with Code

    Hi Paul

    I'm a bit confused as to your expected output. Show me what the first 25-30 Rows will look like of your expected output.

    If you show me this you can forget about this
    Please attach a File that includes ALL the Code you reference here; that will help me understand a bit better what you're trying to do.
    the code for the above is similar to this below (cut from a previous code)
    Also, what are the Rand Formulas...I'm assuming they should be replaced with Values...is this correct?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replacing Multiple Formulas code
    By jshaw82 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-26-2013, 03:59 PM
  2. Replacing all formulas in a folder of workbooks
    By baeiou in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-25-2012, 06:14 AM
  3. replacing values in linked formulas
    By tkh007 in forum Excel General
    Replies: 1
    Last Post: 07-06-2010, 01:45 AM
  4. Replacing 0 with blank in formulas
    By greyscale in forum Excel General
    Replies: 3
    Last Post: 06-23-2010, 10:30 PM
  5. Replacing Formulas with Values
    By Raman325 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-16-2005, 02:54 PM

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