wnoland

New Member
Joined
May 2, 2012
Messages
5
I'd like to tell users what to input with existing text. If cell contents are deleted or it remains blank and nothing is input, default text should display i.e. Enter Client Name.

Been trying to get there with conditional formatting and I can't make text appear when starting with blank
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
I'd like to tell users what to input with existing text. If cell contents are deleted or it remains blank and nothing is input, default text should display i.e. Enter Client Name.

Been trying to get there with conditional formatting and I can't make text appear when starting with blank

Conditional formatting can't return a text string. You need a worksheet_change code to do this. What range on the sheet do you want to cover, or if just a single cell, what is the cell address?
 
Upvote 0
Conditional formatting can't return a text string. You need a worksheet_change code to do this. What range on the sheet do you want to cover, or if just a single cell, what is the cell address?


cell would be B2
 
Upvote 0
cell would be B2
Put this in a module for the worksheet of interest. To do this:
right-click the sheet tab and choose "View Code"
copy the code below and paste into the white space in the window that opens
close the window and save the workbook. If using Excel 2007 or later version, use SaveAs and save as a macro-enabled workbook (.xlsm file extension).
Be sure to enable macros or this won't work.
When the user deletes content from B2 this will return "Enter Client Name" to B2.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("B2")) Is Nothing Then Exit Sub
If IsEmpty(Range("B2")) Or Range("B2").Value = vbNullString Then
    Application.EnableEvents = False
    Range("B2").Value = "Enter Client Name"
    Range("B2").EntireColumn.AutoFit
    Application.EnableEvents = True
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,116
Messages
6,128,930
Members
449,479
Latest member
nana abanyin

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