Automatic entry of # in cell

  • Thread starter Thread starter Voodoodan
  • Start date Start date
V

Voodoodan

Hi,

Could anyone show me how a '#' can automatically be entered in front o
any text I type in a cell, please?

For instance, if I type in cell A1 'voodoodan' then cell A1 should sho
'#voodoodan' when I press the enter key.

Many thanks,
Dan
 
Hi
this would require VBA 8using an event procedure). Do you
want to go this way?

Maybe you could use as a workaround a helper column with a
formula like
 
Hi,

Yep I think an event procedure will probably be the best route for thi
one, if possible.

Thanks,
Dan
 
H
then put the following code in your worksheet module:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Intersect(Target, Me.Range("A1:A100")) Is Nothing Then
Exit Sub
End If
If Target.Cells.Count > 1 Then Exit Sub
On Error GoTo errhandler
Application.EnableEvents = False
With Target
If .Value <> "" Then
.Value = "#" & .Value
End If
End With

erhandler:
Application.EnableEvents = True
End Sub
 
Voodoodan > said:
Hi,

Could anyone show me how a '#' can automatically be entered in front of
any text I type in a cell, please?

For instance, if I type in cell A1 'voodoodan' then cell A1 should show
'#voodoodan' when I press the enter key.

Try to make custom number format under Format->Cells, select custom, and in
Type put "#"@. It will place # infront of every cell input in range with
this format.
 

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