AutoInsert into Cell

tobyhutton1234

New Member
Joined
Dec 21, 2010
Messages
24
Hi There,

Does anyone know how can achive this.

When a user clicks on a cell within B5:B800 I want this to automatically appear: RTS2011/ and then after the / the user can input a max for 4 chars after.

Any suggestions would be great.

Regards

Toby
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Something like this pasted into the Sheet code module:
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

    If Not Intersect(Target, Range("$B$5:$B$800")) Is Nothing Then
        With Target
            If .Value = "" Then
                .Value = "RTS2011/"
                With .Validation
                    .Delete
                    .Add Type:=xlValidateCustom, AlertStyle:=xlValidAlertStop, Operator:= _
                        xlBetween, Formula1:="=AND(LEN(" & Target.Address & _
                        ")>8, LEN(" & Target.Address & ")<=12,LEFT(" & Target.Address & _
                        ",8)=""RTS2011/"")"
                    .IgnoreBlank = True
                End With
                Application.SendKeys "{F2}"
            End If
        End With
    End If
    
End Sub

Note - I'm sure there's a better way of editing a cell rather than use Application.SendKeys "{F2}", just couldn't think of it.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,244
Messages
6,170,976
Members
452,372
Latest member
Natalie18

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top