Replace a blank cell with a string using if function

De Bruce

New Member
Joined
May 23, 2019
Messages
30
Good day all,
I have an uncommon challenge. I have a sheet named Sheet1 filled with data, I want a situation when I delete the values in a cell, instead of remaining blank, it will be filled with a string (example "x").
I tried using the IF function from Sheet2 to fill a blank cell in Sheet1
=IF(Sheet1!A5 = "", Sheet1!A5 = "X"). I keep getting an error FALSE from the cell I inserted the formula.
Is there any the get this right.
Thanks in advance.
 
It is the default data entry form that comes with excel. The data entry form is a faster way of imputing and deleting data in a cell. When I delete via the data entry form the x doesn't appear in the cell
I am not familiar with that.
What version of Excel are you using?
Where do you find that?
Can you see the VBA code behind it?
 
Upvote 0

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
The Form needs to be added to the ribbon as it's not part of any of the tabs as standard.
Also there is no way (that I know of) of changing it and when using it to delete/change cells the change event is not triggered.
 
Upvote 0
I am not familiar with that.
What version of Excel are you using?
Where do you find that?
Can you see the VBA code behind it?

it's Office 16, actually it is a default Data Form created in Excel. You can add it to ribbon tab via the option menu.
 
Upvote 0
The Form needs to be added to the ribbon as it's not part of any of the tabs as standard.
Also there is no way (that I know of) of changing it and when using it to delete/change cells the change event is not triggered.

Thanks Fluff, perhaps I'll work on the sheet without the Default Entry Form.
 
Upvote 0
How about:

Code:
Sub replace_cell()
  Dim rng As Variant
  On Error Resume Next
  Set rng = Application.InputBox("Select cells by pressing Control or Shift", "Select", Selection.Address, Type:=8)
  If rng Is Nothing Then Exit Sub Else rng.Value = "xxx"
End Sub
 
Upvote 0
How about:

Code:
Sub replace_cell()
  Dim rng As Variant
  On Error Resume Next
  Set rng = Application.InputBox("Select cells by pressing Control or Shift", "Select", Selection.Address, Type:=8)
  If rng Is Nothing Then Exit Sub Else rng.Value = "xxx"
End Sub

Thanks Dante,
Will I place the code in the Worksheet_Change event or a module?
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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