Results 1 to 7 of 7

Thread: Delete Formula

  1. #1

    Delete Formula



    Register for a FREE account, and/
    or Log in to avoid these ads!

    In Excel file, the user will enter 1 in A1, 2 in A2 then if he entered 3 in A3, I want the 1 in A1 (user already entered) to disperse automatically. If Macro is the only way to do this, can I use “record macro” to record specific steps and then run it for example in a command button? I would appreciate any help.

  2. #2
    Administrator Ken Puls's Avatar
    Join Date
    Mar 2011
    Location
    Nanaimo, BC, Canada
    Posts
    2,021
    Articles
    79
    Blog Entries
    14
    A macro is the only way, yes. Some questions:
    • So user enters 1 in A1, 2 in A2
    • User then enters 3 in A3 and it clears the value in A1
    Now...
    • Are you looking for any value, or only where the entry matches the row number?
    • What happens if a user enters data in A4? Will it clear A2?
    • What happens when they enter data in A1 after the above scenario... does it clear A3 or A2? What is the reason for your selection?
    Ken Puls, FCPA, FCMA, MS MVP (Excel)

    Master your data with Power Query: Purchase your copy of my book M is for Data Monkey today!

    Main Site: http://www.excelguru.ca -||- Blog: http://www.excelguru.ca/blog -||- Forums: http://www.excelguru.ca/forums
    Check out the Excelguru Facebook Fan Page -||- Follow Me on Twitter

    If you've been given VBA code (a macro) for your solution, but don't know where to put it, CLICK HERE.

  3. #3
    Administrator Ken Puls's Avatar
    Join Date
    Mar 2011
    Location
    Nanaimo, BC, Canada
    Posts
    2,021
    Articles
    79
    Blog Entries
    14
    Oh, and does this only happen on column A, or does it happen on all columns?
    Ken Puls, FCPA, FCMA, MS MVP (Excel)

    Master your data with Power Query: Purchase your copy of my book M is for Data Monkey today!

    Main Site: http://www.excelguru.ca -||- Blog: http://www.excelguru.ca/blog -||- Forums: http://www.excelguru.ca/forums
    Check out the Excelguru Facebook Fan Page -||- Follow Me on Twitter

    If you've been given VBA code (a macro) for your solution, but don't know where to put it, CLICK HERE.

  4. #4
    Thank you Ken for your support.
    For the time being, I want to have it in A1 only where I will develop this to cover other area but after I understand the concept.
    I am looking for something like: IF (AND(A3 =True, A1 <> “”), clear A1, 0)

  5. #5
    Administrator Ken Puls's Avatar
    Join Date
    Mar 2011
    Location
    Nanaimo, BC, Canada
    Posts
    2,021
    Articles
    79
    Blog Entries
    14
    Okay, this will do what you've asked I think. Right click the worksheet, choose View Code, and paste the following in there:

    Code:
    Private Sub Worksheet_Change(ByVal Target As Range)
        If Target.Address = "$A$3" Then
            If Target.Value = True Then Target.Parent.Range("$A$1").ClearContents
        End If
    End Sub
    This will only fire if the value in A3 is TRUE (so you should set up data validation to enforce that.) If you want it to fire on any value at all, we'll need to adjust it.
    Ken Puls, FCPA, FCMA, MS MVP (Excel)

    Master your data with Power Query: Purchase your copy of my book M is for Data Monkey today!

    Main Site: http://www.excelguru.ca -||- Blog: http://www.excelguru.ca/blog -||- Forums: http://www.excelguru.ca/forums
    Check out the Excelguru Facebook Fan Page -||- Follow Me on Twitter

    If you've been given VBA code (a macro) for your solution, but don't know where to put it, CLICK HERE.

  6. #6
    I think I am doing something wrong. In the attached simple file, 1% will appear automatically in C10 if you checked the check box in B11. You cannot enter a different % in D10 until you unchecked the box.

    Check the box, 1% appears, uncheck it and enter a new value in D10; go now to B11 and check the box where the 1% will appear and the value that you entered in D10 still there. It should despair
    Your support is appreciated. Thank you.
    Attached Files Attached Files

  7. #7
    Maybe try this
    Code:
     Private Sub CheckBox1_Click() Me.Range("$D$10").ClearContents End Sub

Posting Permissions

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