Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / July 2008

Tip: Looking for answers? Try searching our database.

selection_change adding text to target

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Matt Williamson - 31 Jul 2008 17:44 GMT
Can I use selection_change to modify the current cell?

e.g I want to type 1234 into any cell in column A and have it change to
"Test - 1234 - Test" upon leaving the cell

TIA

Matt
Bernie Deitrick - 31 Jul 2008 18:18 GMT
Matt,

Copy the code below, right-click the sheet tab, select "View Code" and paste the code into the
window that appears.

I've use the change event because you talk about typing in and not just selecting as cell

HTH,
Bernie
MS Excel MVP

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column <> 1 Then Exit Sub
If Target.Cells.Count > 1 Then Exit Sub
If Target.Value = "" Then Exit Sub
Application.EnableEvents = False
Target.Value = "Test - " & Target.Value & " - Test"
Application.EnableEvents = True
End Sub

> Can I use selection_change to modify the current cell?
>
[quoted text clipped - 4 lines]
>
> Matt
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.