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 / General Excel Questions / March 2008

Tip: Looking for answers? Try searching our database.

Update Worksheet Name Base on Cell Input Automatically?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Native - 27 Mar 2008 15:55 GMT
Hello,

I have the following code in a worksheet:

Private Sub Worksheet_Change(ByVal Target As Range)
  If Target.Address(external:=True) _
       = Range("p2").Address(external:=True) Then
       On Error Resume Next
       Me.Name = Target.Value
       On Error GoTo 0
  End If
End Sub

My question is, how do I get the worksheet name to update
automatically? For example, the cell P2 has a lookup based on an input
in cell B3. When I change B3, P2 looks up the text and changes from
blue to say green. However, when I change B3, the worksheet name does
not automatically update.

The only way I can get the worksheet name to update is to open the
cell P2 and hit enter.

Any suggestions?

Thanks
Dave Peterson - 27 Mar 2008 16:26 GMT
If you're using a formula in P2, you should use the worksheet_Calculate event.

Option Explicit
Private Sub Worksheet_Calculate()
   On Error Resume Next
   Me.Name = Me.Range("P2").Value
   If Err.Number <> 0 Then
       Beep
       Err.Clear
   End If
   On Error GoTo 0
End Sub

> Hello,
>
[quoted text clipped - 21 lines]
>
> Thanks

Signature

Dave Peterson

 
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.