Delete cell values

MrThor

New Member
Joined
Aug 13, 2018
Messages
36
Hi,

I want to be able to click on cell "B5" which is called "delete" and rhen be able to choose which cell I want to delete the value in. How do I do?!
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Try this:
This is an auto sheet event script
Your Workbook must be Macro enabled
To install this code:
Right-click on the sheet tab
Select View Code from the pop-up context menu
Paste the code in the VBA edit window
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Modified  8/25/2018  5:59:13 AM  EDT
If Not Intersect(Target, Range("B5")) Is Nothing Then
If Target.Cells.CountLarge > 1 Then Exit Sub
On Error GoTo M
Dim ans As Variant
ans = InputBox("Enter cell location where you want value cleared", , "E2")
Range(ans).ClearContents
End If
Exit Sub
M:
MsgBox "You entered  " & ans & vbNewLine & "Which is a improper Range"
End Sub
 
Upvote 0
or try this
Simply type the cell reference into cell B5 and Enter

goes in sheet module ( right-click sheet tab \ View Code \ paste in code window)
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$B$5" Then
        Application.EnableEvents = False
        Range(Target.Value).ClearContents
        Target.Value = "Delete?"
        Application.EnableEvents = True
    End If
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,907
Messages
6,175,300
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top