help please

K

kush28

i wish to write something in a cell for eg.

Please enter company name here.

and as soon as the user clicks on that cell.. it dissapears ?


can anyone help please.

Thank
 
N

Norman Jones

Hi Kush28,

Try:

'=============>>
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rng As Range
Const sStr As String = "Please enter company name here."

If Target.Count > 1 Then Exit Sub

Set rng = Range("A1") '<<==== CHANGE

If Not Intersect(rng, Target) Is Nothing Then
If rng.Value = sStr Then rng.ClearContents
End If

End Sub
'<<=============

Change A1 to your cell of interest.

This is worksheet event code and should be pasted into the worksheets's code
module (not a standard module and not the workbook's ThisWorkbook module):

Right-click the worksheet's tab
Select 'View Code' from the menu and paste the code.
Alt-F11 to return to Excel.

If you are not familiar with macros, you may wish to visit David McRitchie's
'Getting Started With Macros And User Defined Functions' at:

http://www.mvps.org/dmcritchie/excel/getstarted.htm
 
C

CLR

A couple of similar alternatives would be to just write your instructions in
the cell itself, and when the user overtypes it with the company name, the
instructions disappear..........or, consider the Comment Box so your
instructions appear and disappear whenever the cell is moused over.

Vaya con Dios,
Chuck, CABGx3
 
C

Chris Ferguson

Or you could try Data validation.

Menu - data - Validation

Go to the Input message tab and complete the boxes as required.

Chris
 
Top