<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; Выбор последней строки в Excel]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=7702&amp;type=atom" />
	<updated>2012-10-15T12:07:59Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=7702</id>
		<entry>
			<title type="html"><![CDATA[Re: Выбор последней строки в Excel]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=64777#p64777" />
			<content type="html"><![CDATA[<p>Забыл отписаться) </p><p>Все очень просто:<br /></p><div class="codebox"><pre><code>
LastRow=xlSheet.Cells(1,1).SpecialCells(11).row
		xlSheet.Cells(LastRow+1,1).select
		xlSheet.Paste</code></pre></div><p>Спасибо за помощь!!!!!!!</p>]]></content>
			<author>
				<name><![CDATA[lyfffi]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=28220</uri>
			</author>
			<updated>2012-10-15T12:07:59Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=64777#p64777</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Выбор последней строки в Excel]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=64776#p64776" />
			<content type="html"><![CDATA[<p>xlSheet.Cells.Item(1,1).SpecialCells(11).Address</p><p>но, но останется - сделайте оформление ячейке ниже нижней и получите её адрес, а не последней заполненной, для последней истинно заполненной нужно пользоваться </p><p>MsgBox xlSheet.Cells.Item(Application.WorksheetFunction.Min(xlSheet.Cells.SpecialCells(11).Row + 1, xlSheet.Cells.Rows.Count), 1).End(-4162).Row</p><p>хотя в большинстве достаточно будет спешелкелс</p>]]></content>
			<author>
				<name><![CDATA[smaharbA]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=2911</uri>
			</author>
			<updated>2012-10-15T12:03:23Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=64776#p64776</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Выбор последней строки в Excel]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=64772#p64772" />
			<content type="html"><![CDATA[<p>Уже понял что за но. SpecialCells(11) выполняет роль сочетания клавиш Ctrl+End и переходит в конец таблицы, а не в ячейку &quot;A&quot; &amp;</p>]]></content>
			<author>
				<name><![CDATA[lyfffi]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=28220</uri>
			</author>
			<updated>2012-10-15T11:27:14Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=64772#p64772</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Выбор последней строки в Excel]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=64771#p64771" />
			<content type="html"><![CDATA[<p>xlSheet.Cells.SpecialCells(11).Address</p><p>но есть но.</p>]]></content>
			<author>
				<name><![CDATA[smaharbA]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=2911</uri>
			</author>
			<updated>2012-10-15T11:15:54Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=64771#p64771</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Выбор последней строки в Excel]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=64769#p64769" />
			<content type="html"><![CDATA[<p>Добрый день!</p><p>Необходимо находить последнюю ячейку в столбце (А1). На данный момент рабочий вариант есть (поиск пустой ячейки), но хотелось бы узнать о существовании более быстрого варианта, потому что при наличии &gt; 5000 строк, скрипт выполняется очень долго.</p><p>Мой код:<br /></p><div class="codebox"><pre><code>
&#039;********** Создаем объект Excel ****************************************************
  		Set xlApp = CreateObject(&quot;Excel.Application&quot;)
		
		&#039;********** Устанавливаем видимость объекта *****************************************
		xlApp.Visible = true
		
		&#039;*********** Назначаем переменные для открытия книги, листа, объекта ****************
		Set xlWB = xlApp.Workbooks.Open(FileName)
		Set xlSheet = xlWB.Worksheets(1)
		Set obj = ActiveDocument.GetSheetObject(ChartName) 
		
		&#039;*********** Активируем лист ********************************************************
		xlSheet.Activate
	
		&#039;*********** Ищем последнюю заполненую ячейку и переходим на пустую *****************
		
		While Not (Isempty(xlSheet.Cells(iRow, 1))) &#039;******************Хотелось бы избавиться от этогу куска кода!!!!!!!.
			iRow = iRow+1
		Wend
		
		&#039;*********** Обращаемся к таблице из приложения и копируем её в буфер ***************
		
		Set txt1 = ActiveDocument.GetSheetObject(&quot;CH27&quot;)
		txt1.CopyTableToClipboard true
		
		&#039;*********** Выбираем пустую ячейку и вставляем из буфера таблицу *******************
		iRow=1
		xlSheet.Cells(iRow,1).EndRow.Select&#039;xlSheet.Cells(iRow,1).Select
		xlSheet.Paste</code></pre></div>]]></content>
			<author>
				<name><![CDATA[lyfffi]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=28220</uri>
			</author>
			<updated>2012-10-15T11:11:34Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=64769#p64769</id>
		</entry>
</feed>
