Isert - ("Dash Mark")

  • Thread starter Thread starter Steved
  • Start date Start date
S

Steved

Hello from Steved

I have over 300 each day to do .

The objective is as I type 36 it will add L- to become Ll-36 and so on, yes
it could be any number fropm 5 to 99 but always 2-digits.

How can I acheive this please it will been in Col H:H only.

Thankyou.
 
Insert this event macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Set h = Range("H:H")
s = "L-"
If Intersect(t, h) Is Nothing Then Exit Sub
Application.EnableEvents = False
t.Value = s & t.Value
Application.EnableEvents = True
End Sub

Because it is worksheet code, it is very easy to install and automatic to use:

1. right-click the tab name near the bottom of the Excel window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you have any concerns, first try it on a trial worksheet.

If you save the workbook, the macro will be saved with it.


To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

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

To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm
 
Hello from Steved

I thankyou.

Gary''s Student said:
Insert this event macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Set h = Range("H:H")
s = "L-"
If Intersect(t, h) Is Nothing Then Exit Sub
Application.EnableEvents = False
t.Value = s & t.Value
Application.EnableEvents = True
End Sub

Because it is worksheet code, it is very easy to install and automatic to use:

1. right-click the tab name near the bottom of the Excel window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you have any concerns, first try it on a trial worksheet.

If you save the workbook, the macro will be saved with it.


To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

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

To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm
 
Back
Top