<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VBA%2FExcel%2FAccess%2FWord%2FExcel%2FSelection</id>
		<title>VBA/Excel/Access/Word/Excel/Selection - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VBA%2FExcel%2FAccess%2FWord%2FExcel%2FSelection"/>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VBA/Excel/Access/Word/Excel/Selection&amp;action=history"/>
		<updated>2026-04-06T23:37:23Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VBA/Excel/Access/Word/Excel/Selection&amp;diff=1508&amp;oldid=prev</id>
		<title> в 16:33, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VBA/Excel/Access/Word/Excel/Selection&amp;diff=1508&amp;oldid=prev"/>
				<updated>2010-05-26T16:33:00Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 16:33, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VBA/Excel/Access/Word/Excel/Selection&amp;diff=1509&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VBA/Excel/Access/Word/Excel/Selection&amp;diff=1509&amp;oldid=prev"/>
				<updated>2010-05-26T12:47:20Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Code does / does not use With-End With==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;vb&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Sub selectionDemo()&lt;br /&gt;
    Selection.HorizontalAlignment = xlCenter&lt;br /&gt;
    Selection.VerticalAlignment = xlCenter&lt;br /&gt;
    Selection.WrapText = True&lt;br /&gt;
    Selection.Orientation = 0&lt;br /&gt;
    Selection.ShrinkToFit = False&lt;br /&gt;
    Selection.MergeCells = False&lt;br /&gt;
    &lt;br /&gt;
    With Selection&lt;br /&gt;
        .HorizontalAlignment = xlCenter&lt;br /&gt;
        .VerticalAlignment = xlCenter&lt;br /&gt;
        .WrapText = True&lt;br /&gt;
        .Orientation = 0&lt;br /&gt;
        .ShrinkToFit = False&lt;br /&gt;
        .MergeCells = False&lt;br /&gt;
    End With&lt;br /&gt;
End Sub&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Counts columns in a multiple selection==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;vb&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Sub CountColumnsMultipleSelections()        &lt;br /&gt;
    AreaCount = Selection.Areas.Count&lt;br /&gt;
    If AreaCount &amp;lt;= 1 Then&lt;br /&gt;
        MsgBox &amp;quot;The selection contains &amp;quot; &amp;amp; Selection.Columns.Count &amp;amp; &amp;quot; columns.&amp;quot;&lt;br /&gt;
    Else&lt;br /&gt;
        For i = 1 To AreaCount&lt;br /&gt;
            MsgBox &amp;quot;Area &amp;quot; &amp;amp; i &amp;amp; &amp;quot; of the selection contains &amp;quot; &amp;amp; Selection.Areas(i).Columns.Count &amp;amp; &amp;quot; columns.&amp;quot;&lt;br /&gt;
        Next i&lt;br /&gt;
    End If&lt;br /&gt;
End Sub&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Determining the type of selected range==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;vb&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Sub Main()&lt;br /&gt;
   Debug.Print AreaType(Selection)&lt;br /&gt;
End Sub&lt;br /&gt;
Function AreaType(RangeArea As range) As String&lt;br /&gt;
&amp;quot;   Returns the type of a range in an area&lt;br /&gt;
    Select Case True&lt;br /&gt;
        Case RangeArea.Count = 1&lt;br /&gt;
            AreaType = &amp;quot;Cell&amp;quot;&lt;br /&gt;
        Case RangeArea.Count = Cells.Count&lt;br /&gt;
            AreaType = &amp;quot;Worksheet&amp;quot;&lt;br /&gt;
        Case RangeArea.Rows.Count = Cells.Rows.Count&lt;br /&gt;
            AreaType = &amp;quot;Column&amp;quot;&lt;br /&gt;
        Case RangeArea.Columns.Count = Cells.Columns.Count&lt;br /&gt;
            AreaType = &amp;quot;Row&amp;quot;&lt;br /&gt;
        Case Else&lt;br /&gt;
            AreaType = &amp;quot;Block&amp;quot;&lt;br /&gt;
    End Select&lt;br /&gt;
End Function&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Find next heading==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;vb&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 Sub FindNextHeading()&lt;br /&gt;
     Do Until Left(Selection.Paragraphs(1).Style, 7) = &amp;quot;Heading&amp;quot;&lt;br /&gt;
         Selection.MoveDown Unit:=wdParagraph, _&lt;br /&gt;
             Count:=1, Extend:=wdMove&lt;br /&gt;
     Loop&lt;br /&gt;
 End Sub&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Get selection address==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;vb&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Sub GetSelectionAddress()&lt;br /&gt;
    ActiveSheet.Names.Add Name:=&amp;quot;MyRange2&amp;quot;, RefersTo:=&amp;quot;=&amp;quot; &amp;amp; Selection.Address()&lt;br /&gt;
End Sub&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Get the address of selection==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;vb&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Sub getSelectionAddress&lt;br /&gt;
   Selection.Address&lt;br /&gt;
End Sub&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Is the current selection a Range==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;vb&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Sub EnterAvg()&lt;br /&gt;
    If TypeName(Selection) &amp;lt;&amp;gt; &amp;quot;Range&amp;quot; Then Exit Sub&lt;br /&gt;
End Sub&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Returns a count of all cells in a selection: using the Selection and Count properties==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;vb&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Sub CountAllCells()&lt;br /&gt;
    Dim myCount As Integer                    &lt;br /&gt;
    myCount = Selection.Count&lt;br /&gt;
    MsgBox &amp;quot;The total number of cell(s) in this selection is : &amp;quot; _&lt;br /&gt;
         &amp;amp; myCount, vbInformation, &amp;quot;Count Cells&amp;quot;&lt;br /&gt;
End Sub&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Returns a count of the number of columns in a selection==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;vb&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Sub CountColumns() &lt;br /&gt;
    Dim myCount As Integer                     &lt;br /&gt;
    myCount = Selection.Columns.Count&lt;br /&gt;
    MsgBox &amp;quot;This selection contains &amp;quot; &amp;amp; myCount &amp;amp; &amp;quot; columns&amp;quot;, vbInformation, &amp;quot;Count Columns&amp;quot;&lt;br /&gt;
End Sub&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Returns a count of the number of rows in a selection==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;vb&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Sub CountRows()&lt;br /&gt;
    Dim myCount As Integer&lt;br /&gt;
    myCount = Selection.Rows.Count&lt;br /&gt;
    MsgBox &amp;quot;This selection contains &amp;quot; &amp;amp; myCount &amp;amp; &amp;quot; row(s)&amp;quot;, vbInformation, &amp;quot;Count Rows&amp;quot;&lt;br /&gt;
End Sub&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Selection move down==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;vb&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Sub loopDemo()&lt;br /&gt;
    Dim i As Integer&lt;br /&gt;
    For i = 1 To ActiveDocument.Paragraphs.Count&lt;br /&gt;
        Application.StatusBar = &amp;quot;formatting&amp;quot; &amp;amp; i &amp;amp; &amp;quot; out of &amp;quot; &amp;amp; ActiveDocument.Paragraphs.Count &amp;amp; &amp;quot;...&amp;quot;&lt;br /&gt;
        Selection.MoveDown Unit:=wdParagraph, Count:=1, Extend:=wdMove&lt;br /&gt;
    Next i&lt;br /&gt;
End Sub&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==To add a range name based on a selection==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;vb&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Sub AddName4()&lt;br /&gt;
    Selection.Name = &amp;quot;MyRange4&amp;quot;&lt;br /&gt;
End Sub&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Toggling a Boolean property==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;vb&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Sub ToggleWrapText()&lt;br /&gt;
    If TypeName(Selection) = &amp;quot;Range&amp;quot; Then &lt;br /&gt;
      Selection.WrapText = Not ActiveCell.WrapText&lt;br /&gt;
    End If&lt;br /&gt;
End Sub&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>