+ Reply to Thread
Results 1 to 5 of 5

Method `Range of object_'Worksheet' failed - Trying to write variable to cell

  1. #1
    Registered User
    Join Date
    11-13-2013
    Location
    Aberdeenshire, Scotland
    MS-Off Ver
    Excel 2010
    Posts
    3

    Method `Range of object_'Worksheet' failed - Trying to write variable to cell

    Hi All - Hoping someone can assist.

    I am trying to update a spreadsheet I have used for carrying out a wall thickness calculation on piping, and thought it would be a great idea to try and learn VBA at the same time. I have managed to put together some code that generally does what I need (basically finding values in a table of data and interpolating to get intermediate figures) but I am getting an error trying to write the result to a cell.

    Error:
    Run-time error '-2147417848 (80010108)':
    Method `Range of object_'Worksheet' failed

    I then get `Not Enough System Resources to Display Completely'

    Please Login or Register  to view this content.
    Any help/pointer would be very much appreciated :-)

    Thanks

    Steve
    Last edited by stevemcd1; 12-17-2013 at 04:00 PM.

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Complete Newbie Need HELP!

    You got way too many unsued variable and you didn't actually define any of them. They are all set to variant as default. The big issue is that you are running this as a worksheet change event rather than a macro.

    Edit: Holding off on answer till you comply with mod's request.

  3. #3
    Registered User
    Join Date
    11-13-2013
    Location
    Aberdeenshire, Scotland
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Method `Range of object_'Worksheet' failed - Trying to write variable to cell

    Apologies, Title updated :-)

    stnkynts, there are other calculations that I need to add once I fully understand this first one - the variables relate to future calculations so probably should have removed them for this exercise. :-) Regarding defining them, I am reading up on that now.

    I thought the event change would be the best was as I want it to update the calculations as I change the parameters via drop downs and manual entries (pressures, temperatures, materials etc).

    Thanks

    Steve

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Method `Range of object_'Worksheet' failed - Trying to write variable to cell

    One of the problems that you are going to run into is a constant loop of worksheet changes. Example: You enter a value in A1 which trigger your macro which put a value in M16. By putting the value in M16 it trigger the macro to occur again, and so on and so on. This can be disabled by setting Application.EnableEvents = False. The best way would be to code the worksheet change event to be range specific so that it only occurs on the change of certain drop downs and manual entries. That information was not provided.

  5. #5
    Registered User
    Join Date
    11-13-2013
    Location
    Aberdeenshire, Scotland
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Method `Range of object_'Worksheet' failed - Trying to write variable to cell

    stnkynts, appreciate the responses :-)

    I have attached a copy of the file as it currently stands for additional information.

    Many thanks

    Steve

    00 - NEW WALL CALC - VBA.xlsm

+ 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. Using If Statement to format a bookmark (complete newbie)
    By kiwigal in forum Word Programming / VBA / Macros
    Replies: 1
    Last Post: 01-30-2013, 06:41 AM
  2. A complete newbie - please help with a password problem
    By alexisemma31 in forum Excel General
    Replies: 9
    Last Post: 08-02-2012, 02:36 AM
  3. Replies: 4
    Last Post: 06-13-2012, 01:34 AM
  4. complete macro newbie
    By savfam02 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-25-2010, 09:14 PM
  5. If then:complete newbie
    By Cydney in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-27-2009, 01:31 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