Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Area references highliting from addin

In Excel when typing formula with references or when selecting chart with
linked data worksheet shows color rectangles, associated with references.
I am writing addin and I need to highlight some areas on worksheet from
addin. How can I use existing highlight functionality? Or I have to write my
own implementation?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Area references highliting from addin

To the best of my knowledge, this capability is not programmable. However,
if you are writing a custom function, I believe selecting the arguments for
that function in the formula bar will produce the same effect. At least it
does for me.

--
Regards,
Tom Ogilvy



"Ivan V. Inozemtsev" wrote in message
...
In Excel when typing formula with references or when selecting chart with
linked data worksheet shows color rectangles, associated with references.
I am writing addin and I need to highlight some areas on worksheet from
addin. How can I use existing highlight functionality? Or I have to write

my
own implementation?




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Area references highliting from addin

Ivan,

Attached is a sample of code from the CFPlus add-in that highlights a named
range (similar to what I think you want). Feel free to utilise it

'---------------------------------------------------------------------------
Public Sub CFHighlight(oName As Name, oSheet As Worksheet)
'---------------------------------------------------------------------------
' Function: Highlights all applied conditional formats for this sheet
' Uses shape objects for doing the highlighting
'---------------------------------------------------------------------------
Dim oShape As Shape
Dim CFRange As Range
Dim oCFAreas As Range
Dim dTop As Double
Dim dLeft As Double
Dim dWidth As Double
Dim dHeight As Double
Dim iTxtSize As Long
Dim iArea As Integer

On Error Resume Next

Set CFRange = Range(oName.RefersTo)
If CFRange Is Nothing Then
Exit Sub
End If
iArea = 0
For Each oCFAreas In CFRange.Areas
iArea = iArea + 1
dTop = oCFAreas.Cells(1, 1).Top
dLeft = oCFAreas.Cells(1, 1).Left
dWidth = oCFAreas.Cells(oCFAreas.Rows.Count,
oCFAreas.Columns.Count).Left + _
oCFAreas.Cells(oCFAreas.Rows.Count,
oCFAreas.Columns.Count).Width - dLeft
dHeight = oCFAreas.Cells(oCFAreas.Rows.Count,
oCFAreas.Columns.Count).Top + _
oCFAreas.Cells(oCFAreas.Rows.Count,
oCFAreas.Columns.Count).Height - dTop
iTxtSize = CInt(Application.Min(36, Application.Max( _
Application.Min(dWidth / 2,
dHeight / 30), 8)))

Set oShape = oSheet.Shapes.AddTextbox(msoTextOrientationHorizon tal,
dLeft, _
dTop, dWidth, dHeight)
With oShape
.Name = "CFPlus - " & iArea & "-" & Right(oName.Name, 4)
.Fill.ForeColor.SchemeColor = 13
.Fill.Transparency = 0.9
.OnAction = "CFHighlightClick"
With .TextFrame
.Characters.Text = Right(oName.Name, 4)
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
If dWidth dHeight Then
.Orientation = xlHorizontal
Else
.Orientation = msoTextOrientationUpward
End If
.AutoSize = False
End With
With .Line
.Weight = 1#
.DashStyle = msoLineDash
.Style = msoLineSquareDot
.Transparency = 0#
.Visible = msoTrue
.ForeColor.SchemeColor = 54
.BackColor.RGB = RGB(255, 255, 255)
End With
With .TextFrame.Characters(1, .TextFrame.Characters.Count).Font
.Name = "Arial"
.Size = iTxtSize
.Underline = xlUnderlineStyleNone
.ColorIndex = 47
End With
End With
Next

'Clear variables
Set oShape = Nothing
Set CFRange = Nothing
Set oCFAreas = Nothing
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Ivan V. Inozemtsev" wrote in message
...
In Excel when typing formula with references or when selecting chart with
linked data worksheet shows color rectangles, associated with references.
I am writing addin and I need to highlight some areas on worksheet from
addin. How can I use existing highlight functionality? Or I have to write

my
own implementation?




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
Adding area codes only to phone numbers missing an area code RC Excel Discussion (Misc queries) 5 May 3rd 23 05:06 PM
My cursor is highliting 3 cells instead of just one. cheryl Excel Worksheet Functions 4 November 6th 09 05:30 AM
Highliting Duplicate Cells across multiple rows equinekingdom Excel Worksheet Functions 4 April 14th 06 01:34 AM
Mouse highliting excel cells rocker Excel Discussion (Misc queries) 2 October 13th 05 07:21 PM
Remove Excel AddIn from AddIn List !! Help carl Excel Programming 2 December 8th 03 03:36 PM


All times are GMT +1. The time now is 05:16 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"