help please

  • Thread starter Thread starter kush28
  • Start date Start date
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
 
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
 
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
 
Or you could try Data validation.

Menu - data - Validation

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

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top