summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/source/core/data/document.cxx2
-rw-r--r--sc/source/ui/view/viewfun3.cxx5
2 files changed, 2 insertions, 5 deletions
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 551331367938..0f53226f47c1 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -1661,7 +1661,7 @@ void ScDocument::InitUndoSelected( ScDocument* pSrcDoc, const ScMarkData& rTabSe
xPoolHelper = pSrcDoc->xPoolHelper;
String aString;
- for (SCTAB nTab = 0; nTab < rTabSelection.GetLastSelected(); nTab++)
+ for (SCTAB nTab = 0; nTab <= rTabSelection.GetLastSelected(); nTab++)
if ( rTabSelection.GetTableSelect( nTab ) )
{
ScTable* pTable = new ScTable(this, nTab, aString, bColInfo, bRowInfo);
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index 03481f6418bf..a3c1ab317eb9 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -1551,10 +1551,7 @@ bool ScViewFunc::PasteMultiRangesFromClip(
// Determine the first and last selected sheet numbers.
SCTAB nTab1 = aMark.GetFirstSelected();
- SCTAB nTab2 = nTab1;
- for (SCTAB i = nTab1+1; i < aMark.GetLastSelected(); ++i)
- if (aMark.GetTableSelect(i))
- nTab2 = i;
+ SCTAB nTab2 = aMark.GetLastSelected();
ScDocShellModificator aModificator(*pDocSh);