Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
HilcrRWise
 
Posts: n/a
Default Cell Value on Toolbar


Is it possible to show the value of a cell on a custom toolbar. Cell
location will not change, but cell content will.


--
HilcrRWise
------------------------------------------------------------------------
HilcrRWise's Profile: http://www.excelforum.com/member.php...o&userid=11699
View this thread: http://www.excelforum.com/showthread...hreadid=494807

  #2   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default Cell Value on Toolbar

One way

Option Explicit

Const WS_RANGE As String = "B10"

Private Sub Worksheet_Activate()
Dim oCtl As CommandBarControl

On Error Resume Next
Set oCtl = Application.CommandBars.FindControl(Tag:="cellValu e")
oCtl.Delete
On Error GoTo 0
With Application.CommandBars("Standard"). _
Controls.Add(Type:=msoControlButton)
.Tag = "cellValue"
.Style = msoButtonCaption
.Caption = Me.Range(WS_RANGE).Value
End With
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
Dim oCtl As CommandBarControl

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
Set oCtl = CommandBars.FindControl(Tag:="cellValue")
oCtl.Caption = Target.Value
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.




--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"HilcrRWise" wrote
in message ...

Is it possible to show the value of a cell on a custom toolbar. Cell
location will not change, but cell content will.


--
HilcrRWise
------------------------------------------------------------------------
HilcrRWise's Profile:

http://www.excelforum.com/member.php...o&userid=11699
View this thread: http://www.excelforum.com/showthread...hreadid=494807



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Transfer Cell Formatting for linked cells Scott Excel Discussion (Misc queries) 2 November 23rd 05 11:04 PM
copying cell names Al Excel Discussion (Misc queries) 12 August 11th 05 03:01 PM
cell color index comparison MINAL ZUNKE New Users to Excel 1 June 30th 05 07:11 AM
Toolbar problem Anthony Excel Discussion (Misc queries) 1 June 1st 05 01:05 AM
Stubborn toolbars in Excel 007 Excel Discussion (Misc queries) 9 December 11th 04 02:02 PM


All times are GMT +1. The time now is 09:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"