Page 1 of 3 123 LastLast
Results 1 to 10 of 24

Thread: Condition Check for the Current Cell

  1. #1
    New Member
    Join Date
    Jun 2015
    Posts
    26
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Condition Check for the Current Cell

    Hello Friends,
    Cell A1=1, A2=1, A3=A1*A2

    When I change A1 Value and if it gives A3>previous value I would like to store the A1=A4
    kindly guide me

    Regards
    Last edited by treeppm; Jul 26th, 2018 at 12:46 AM. Reason: missed word

  2. #2
    Board Regular
    Join Date
    Sep 2016
    Posts
    2,077
    Post Thanks / Like
    Mentioned
    21 Post(s)
    Tagged
    1 Thread(s)

    Default Re: Condition Check for the Current Cell

    Do you want to put the new A1 value in A4 or the previous A1 value?
    What about A3 < A3 previous value - should A4 be cleared?
    Last edited by footoo; Jul 26th, 2018 at 01:21 AM.

  3. #3
    New Member
    Join Date
    Jun 2015
    Posts
    26
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Condition Check for the Current Cell

    Quote Originally Posted by footoo View Post
    Do you want to put the new A1 value in A4 or the previous A1 value?
    What about A3 < A3 previous value - should A4 be cleared?
    Cell A1=1, A2=1, A3=A1*A2


    When I change A1 Value and if it gives A3>previous value I would like to store the A1=A4

    like this


    and like this


    Kind Regards
    Last edited by treeppm; Jul 26th, 2018 at 01:42 AM.

  4. #4
    Board Regular
    Join Date
    Sep 2016
    Posts
    2,077
    Post Thanks / Like
    Mentioned
    21 Post(s)
    Tagged
    1 Thread(s)

    Default Re: Condition Check for the Current Cell

    You didn't advise what you want to happen if A3 is less than before.
    Code:
    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim x#, y#
    If Target.Address <> "$A$1" Then Exit Sub
    Application.EnableEvents = False
    x = [A1]
    y = [A3]
    Application.Undo
    If [A3] < y Then [A4] = x
    [A1] = x
    Application.EnableEvents = True
    End Sub

  5. #5
    New Member
    Join Date
    Jun 2015
    Posts
    26
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Condition Check for the Current Cell

    Sorry dude, It should not change anything. only the A4 change if greater than previous.
    and Is there possible that we can use formulas (like we use = in cell?)

    PS:How to use this program with in excell?
    oops. Got that. Rightclick., and view code
    Kind Regards
    Last edited by treeppm; Jul 26th, 2018 at 01:54 AM.

  6. #6
    Board Regular
    Join Date
    Sep 2016
    Posts
    2,077
    Post Thanks / Like
    Mentioned
    21 Post(s)
    Tagged
    1 Thread(s)

    Default Re: Condition Check for the Current Cell

    I don't know a way to do it with a formula.

  7. #7
    New Member
    Join Date
    Jun 2015
    Posts
    26
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Condition Check for the Current Cell

    Dude, the calculation is not correct.
    Here is example.,
    type 68 in A1
    type 10 in A2
    Now the A3 will be 680 so this is current high value

    and now change to A1 to 67
    and A2 to 16 now the value of A3 is 1072 which is higher than previous it was

    so the A4 must show now 67 but It shows 68
    Last edited by treeppm; Jul 26th, 2018 at 03:42 AM.

  8. #8
    Board Regular
    Join Date
    Sep 2016
    Posts
    2,077
    Post Thanks / Like
    Mentioned
    21 Post(s)
    Tagged
    1 Thread(s)

    Default Re: Condition Check for the Current Cell

    This is the first time you've mentioned that you also want to change A4 if A2 is changed - you previously only mentioned a change in A1,
    Code:
    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim x#, y#, z#
    If Target.Address <> "$A$1" And Target.Address <> "$A$2" Then Exit Sub
    Application.EnableEvents = False
    x = [A1]
    z = [A2]
    y = [A3]
    Application.Undo
    If [A3] < y Then [A4] = x
    [A1] = x
    [A2] = z
    Application.EnableEvents = True
    End Sub

  9. #9
    New Member
    Join Date
    Jun 2015
    Posts
    26
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Condition Check for the Current Cell

    Quote Originally Posted by footoo View Post
    This is the first time you've mentioned that you also want to change A4 if A2 is changed - you previously only mentioned a change in A1,
    Sorry brother, It's lack of my English knowledge. If I'd explained like this before you'd understand well.

  10. #10
    New Member
    Join Date
    Jun 2015
    Posts
    26
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Condition Check for the Current Cell

    bro, it need another extra thing.
    If suppose I enter 500 in A1 and 22 in A2 the value of A3 is 11000 and the A4 is Now 500
    and again If I enter 68 in A1 and 10 in A2 Now the A3 shows 680 and A4 is now 500
    and now change to 67 in A1 and 16 in A2 now the value of A3 is 1072 the A4 value changed to 67
    But the result I expect in A4 is still 500 (because we got higher value 11000 in A3 while we used that)

    Kind Regards
    Last edited by treeppm; Jul 26th, 2018 at 06:07 AM. Reason: miss type

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •