+ Reply to Thread
Results 1 to 12 of 12

Changing a cell value if criteria are met

  1. #1
    Forum Contributor
    Join Date
    04-19-2013
    Location
    Yorkshire, England
    MS-Off Ver
    Excel 2010
    Posts
    297

    Changing a cell value if criteria are met

    I am trying to change a value in a cell in column C if the values in column A & B match certain criteria.

    I have come up with the following code:

    Please Login or Register  to view this content.

    But it is producing an error- the debugger highlights this line:

    Please Login or Register  to view this content.
    Where am I going wrong here?

    Thanks in advance for any help offered

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Changing a cell value if criteria are met

    Just a guess but maybe:

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    04-19-2013
    Location
    Yorkshire, England
    MS-Off Ver
    Excel 2010
    Posts
    297

    Re: Changing a cell value if criteria are met

    Hi John, thanks for the suggestion, but unfortunately that returns an error and highlights the line in the debugger.

    So I think it may need to be different..?

  4. #4
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Changing a cell value if criteria are met

    I am really confused on this line

    Please Login or Register  to view this content.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  5. #5
    Forum Contributor
    Join Date
    04-19-2013
    Location
    Yorkshire, England
    MS-Off Ver
    Excel 2010
    Posts
    297

    Re: Changing a cell value if criteria are met

    Confused? as to what?

  6. #6
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Changing a cell value if criteria are met

    .value, .text etc are properties of, for example, a range object or something like that. vData is a variant variable, it doesn't have any properties, so you just need:
    Please Login or Register  to view this content.

  7. #7
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Changing a cell value if criteria are met

    Just drop the .Value.

  8. #8
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Changing a cell value if criteria are met

    Quote Originally Posted by strud View Post
    Confused? as to what?
    Oops... Mis interpreted, please ignore

  9. #9
    Forum Contributor
    Join Date
    04-19-2013
    Location
    Yorkshire, England
    MS-Off Ver
    Excel 2010
    Posts
    297

    Re: Changing a cell value if criteria are met

    Thanks guys...that got it.

    Ockham's razor - the simplest answer is always the one your looking for

  10. #10
    Forum Contributor
    Join Date
    04-19-2013
    Location
    Yorkshire, England
    MS-Off Ver
    Excel 2010
    Posts
    297

    Re: Changing a cell value if criteria are met

    as an extension of the abiove, it now doesn't return an error- but on testing the value is not changing when it should (i.e. the criteria are met).

    Anybody any ideas why not?

  11. #11
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Changing a cell value if criteria are met

    Well, there is nothing in the code to assign the array to the worksheet range after you have changed the cells..maybe:
    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    04-19-2013
    Location
    Yorkshire, England
    MS-Off Ver
    Excel 2010
    Posts
    297

    Re: Changing a cell value if criteria are met

    Thanks yudlugar that's brilliant! I didn't realise I had to assign like that

    I just had to remove the .Value from
    Please Login or Register  to view this content.
    as you advised above.

    But other than it works perfectly- cheers

+ 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. [SOLVED] Changing fill color of shapes based on changing cell value
    By Stefan1983 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-25-2012, 10:33 AM
  2. how to get value based on changing criteria?
    By pemnuts in forum Excel General
    Replies: 3
    Last Post: 01-15-2012, 04:44 PM
  3. Replies: 0
    Last Post: 03-31-2011, 09:42 AM
  4. changing cell color based on changing values
    By tvonbehren in forum Excel General
    Replies: 2
    Last Post: 09-16-2009, 12:33 PM
  5. i have 3 criteria to count from which 1 is changing
    By eknath in forum Excel General
    Replies: 4
    Last Post: 05-22-2006, 05:35 AM

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