+ Reply to Thread
Results 1 to 8 of 8

Problems with Range

  1. #1
    Registered User
    Join Date
    01-26-2009
    Location
    Hanko, Finland
    MS-Off Ver
    Excel 2003
    Posts
    13

    Problems with Range

    Please Login or Register  to view this content.
    There's the sub. Basicly if cell that got changed is in A column and value in the cell isn't empty I want to set formula to B column of that cells row(and use cells value in formula). However it halts in the If clause claiming type mismatches.

    Where it is missing? My guess is that value but didn't range objects have value?

    (btw how would this operate if more than one cell gets changed. Say copy&paste order?)
    Last edited by tneva; 02-02-2009 at 07:31 AM.

  2. #2
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264

    Re: Problems with Range

    Syntax looks OK to me. Is it only a single cell you are changing when the code fails? Just to be perfectly clear, please indicate exactly which line the code fails on and provide the exact error the debugger reports.

    Richard
    Richard Schollar
    Microsoft MVP - Excel

  3. #3
    Registered User
    Join Date
    01-26-2009
    Location
    Hanko, Finland
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Problems with Range

    Quote Originally Posted by RichardSchollar View Post
    Syntax looks OK to me. Is it only a single cell you are changing when the code fails? Just to be perfectly clear, please indicate exactly which line the code fails on and provide the exact error the debugger reports.

    Richard
    Yes cell A251 is the one that change. It stops in the line with IF in it(2nd line) with runtime error 13: Type Mismatch.

    No more information comes in error message.

    And here's the line in full:

    Please Login or Register  to view this content.
    Edit: Seems to be target.value that is causing problems. Removed it, if clause passed, halts in same error in next line where there is, or atleast should be, yet another target.value(which is just a number like 424635).
    Last edited by tneva; 02-02-2009 at 06:29 AM.

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Problems with Range

    I get a type mismatch error if the Target range is more than 1 cell.

    You can not check the Value of multiple cells.
    Cheers
    Andy
    www.andypope.info

  5. #5
    Registered User
    Join Date
    01-26-2009
    Location
    Hanko, Finland
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Problems with Range

    That's odd since there should be only one cell changing :-( Though does mean this doesn't work anyway since just because now it should be one cell doesn't mean in future there won't be multiple lines added.

    Oh bugger.

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Problems with Range

    So you just need to code for multiple cells.

    Should each row in the target range have a formula applied?

    What is the proper formula?

  7. #7
    Registered User
    Join Date
    01-26-2009
    Location
    Hanko, Finland
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Problems with Range

    Quote Originally Posted by Andy Pope View Post
    So you just need to code for multiple cells.

    Should each row in the target range have a formula applied?

    What is the proper formula?
    Yes for every row where number gets added.

    Formula is:

    Please Login or Register  to view this content.
    Where A303 is cell that got changed. Ultimately I will be wanting to change "*-200 day" to be date which is dependant on row above this which is why I'm going macro way(can't figure way to get it working by adding formula to cell itself. I can put date there but how to get it calculate from date above).

    Result will be date and time.

  8. #8
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Problems with Range

    So something more like this.

    Please Login or Register  to view this content.
    Change the formula to your formula with user defined functions.

+ 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