Automatic entry of # in cell

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
 
F

Frank abel

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
 
V

Voodoodan

Hi,

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

Thanks,
Dan
 
F

Frank Kabel

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
 
R

R_R

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.
 
Top