Table of contents
Collapse the table of content
Expand the table of content

Window.SelectedCell Property (Visio)

office 365 dev account|Last Updated: 6/12/2017
1 Contributor

Returns the selected cell in the ShapeSheet window. Read-only.


expression . SelectedCell

expression A variable that represents a Window object.

Return Value



The SelectedCell property applies only to ShapeSheet windows. If you try to access the SelectedCell property for any other type of window, Microsoft Visio returns the error message "Invalid window type for this action."

If a ShapeSheet row is selected (instead of a cell), SelectedCell returns Nothing . See the following example.


The following Microsoft Visual Basic for Applications (VBA) macro shows how to use the SelectedCell property to print the name, section, row, column, and formula of the selected ShapeSheet cell in the Immediate window.

Public Sub SelectedCell_Example() 

 Dim vsoCell As Visio.Cell 

 Set vsoCell = Application.ActiveWindow.SelectedCell 

 'If vsoCell is Nothing, a row is probably selected. 
 If (Not vsoCell Is Nothing) Then 
 Debug.Print "Cell Name: " &; vsoCell.Name 
 Debug.Print "Section: " &; vsoCell.Section 
 Debug.Print "Row: " &; vsoCell.Row 
 Debug.Print "Column: " &; vsoCell.Column 
 Debug.Print "Formula: " &; vsoCell.Formula 
 Debug.Print "vsoCell is Nothing--a row is probably selected." 

 End If 

End Sub
© 2018 Microsoft