+ Reply to Thread
Results 1 to 12 of 12

Macro was working but is not now

  1. #1
    Valued Forum Contributor
    Join Date
    01-10-2011
    Location
    swindon, england
    MS-Off Ver
    Excel 2010
    Posts
    317

    Macro was working but is not now

    Hi

    I created this bit of code to clear a cell range and then put a formula in it. It was working yesterday but now it is not and i dont know why.

    Please Login or Register  to view this content.
    I have noticed that excel is putting quote marks in the code but i dont know why. It is putting them in this bit around the cell numbers
    Please Login or Register  to view this content.
    CAN anyone please help me?

    Thank you
    Jeskit
    Last edited by jeskit; 01-17-2011 at 09:31 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Macro was working but is not now

    The quotes are necessary.

    I think attaching the workbook would help
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Valued Forum Contributor
    Join Date
    01-10-2011
    Location
    swindon, england
    MS-Off Ver
    Excel 2010
    Posts
    317

    Re: Macro was working but is not now

    Ok thanks

    I have tried putting Activeworkbook.sheets but it didnt work

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro was working but is not now

    Make sure cells G15:H16 are formatted as General.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  5. #5
    Valued Forum Contributor
    Join Date
    01-10-2011
    Location
    swindon, england
    MS-Off Ver
    Excel 2010
    Posts
    317

    Re: Macro was working but is not now

    hi

    I have checked and they are formatted to general but still not working

  6. #6
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: Macro was working but is not now

    Hello, why don't you upload the workbook, as RoyUK suggested. We can play '20 Questions' but looking at the real thing will be a lot faster.

    "Not working" is not a very precise error description. Do you get an error message? Unexpected results? No results? What?

  7. #7
    Valued Forum Contributor
    Join Date
    01-10-2011
    Location
    swindon, england
    MS-Off Ver
    Excel 2010
    Posts
    317

    Re: Macro was working but is not now

    Hi

    i cant upload the work book as it has information in it which i will get in trouble for letting anyone see.

    When i run the macro it does everything, it clears the cell range, finds the values from cells and places it in the cell range, peforms the formula and produces no error message. However when it gets to the putting the results of the formula in the cell range (G:15, H:15, G:16, H:16) it does not it puts

    Please Login or Register  to view this content.
    and invalid name error.

    I hope this helps.

  8. #8
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: Macro was working but is not now

    After the macro has run, what is the exact formula in the cells with the Name? error? Copy the formula from the formula bar and paste it here.

  9. #9
    Valued Forum Contributor
    Join Date
    01-10-2011
    Location
    swindon, england
    MS-Off Ver
    Excel 2010
    Posts
    317

    Re: Macro was working but is not now

    Hi

    This is the formula code the macro puts in the cell

    Please Login or Register  to view this content.
    put the result is #NAME? but there is a green comment attachted to the cell which says the error is Invalid error name

  10. #10
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: Macro was working but is not now

    Ah, there seem to be superfluous and unwanted ' signs in the formula. It should read

    =MAX('Dealer Extracts'!H15:H35)

    not

    =MAX('Dealer Extracts'!'H15':'H35')

    I don't see how the code you posted would put in the extra ' signs, though.

    Can you strip all confidential data from the workbook, replace with dummy data and post the file?

  11. #11
    Valued Forum Contributor
    Join Date
    01-10-2011
    Location
    swindon, england
    MS-Off Ver
    Excel 2010
    Posts
    317

    Re: Macro was working but is not now

    ok i have stripped everything except what is needed for the macro to work so should be ok

    I think i have attachted the file
    Attached Files Attached Files

  12. #12
    Valued Forum Contributor
    Join Date
    01-10-2011
    Location
    swindon, england
    MS-Off Ver
    Excel 2010
    Posts
    317

    Re: Macro was working but is not now

    Hi Guys

    I found the solution i changed FormulaR1C1 to FormulaArray and it seems to work.

    Thank you for all your help

+ 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