Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
416to420
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
416to420
416to420
Aktuelles Verzeichnis
Verzeichnis Index
Verzeichnis Index
Übersicht Verzeichnisse
Inhaltsverzeichnis

PasteSpecial method of range class failed

PasteSpecial method of range class failed
Mandix
Hallo Leute...
Habe unter Verwendung von VBA in Excel 2002 SP2 ein Programm entwickelt und erhalte jetzt bei älteren Versionen wie Excel 2000 einen Fehler, der unter Excel 2002 nie auftritt:
Run-time error 1004
PasteSpecial method of Range class failed
Hat da jemand eine Ahnung, ob sich im Zuge der Versionsänderung bzgl. dieses Befehlens (PasteSpecial) etwas getan hat? Ich wäre mir keines Fehlers bewußt.
Danke, Mandix.

5
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Benutzer
Anzeige
AW: PasteSpecial method of range class failed
Gerd
Poste doch mal einfach den relevanten Code.
Gerd
Hier der Source-Code des Problems
Mandix
Ok, hier die Problem-Prozedur:

Private Sub bNewLine_Click()
Dim row, copyRow, pasteRow
row = ActiveCell.row
'if we are in the first line of data...
If row = Range("no").row + 2 Then
'...create the row one row deeper and copy the contents of the upper row (reason: formatting)
Selection.Copy
Cells(row + 1, Range("no").Column).Select
ActiveCell.EntireRow.Insert
Selection.PasteSpecial
Cells(row, Range("no").Column).Select
copyRow = ActiveCell.row + 1
Else
ActiveCell.EntireRow.Insert
copyRow = ActiveCell.row - 1
End If
pasteRow = ActiveCell.row
ActiveCell.EntireRow.Select
Selection.ClearContents
Application.CutCopyMode = False
'copy the format for the whole line
Cells(copyRow, 1).EntireRow.Select
Selection.Copy
Cells(pasteRow, 1).EntireRow.PasteSpecial xlPasteFormats
Application.CutCopyMode = False
'copy the formulas of the fields with formulas
Dim cell1
cell1 = Range("duration1").Column
For c = 0 To 6
Range(Cells(copyRow, cell1 + 4 * c), Cells(copyRow, cell1 + 4 * c + 1)).Select
Selection.Copy
Range(Cells(pasteRow, cell1 + 4 * c), Cells(pasteRow, cell1 + 4 * c + 1)).PasteSpecial xlPasteFormulasAndNumberFormats
Application.CutCopyMode = False
Next c
'do the last duration (duration8) explicit, because there is no more break here
Cells(copyRow, Range("duration8").Column).Select
Selection.Copy
Cells(pasteRow, Range("duration8").Column).PasteSpecial xlPasteFormulasAndNumberFormats
Application.CutCopyMode = False
ActiveCell.EntireRow.Select
'important initialization for later calculation of dependencies
Dim initStartCol
initStartCol = Range("start1").Column
For i = 0 To 7
Cells(ActiveCell.row, initStartCol + i * 4) = 0 'start time
Cells(ActiveCell.row, initStartCol + i * 4 + 1) = 0 'end time
Next i
'end of important initialization
Call resetFields
Call updateIndices
End Sub

Anzeige
AW: Hier der Source-Code des Problems
Gerd
xlPasteFormulasAndNumberFormats
ist neu und funktioniert erst ab E 2002
Gerd
AW: Hier der Source-Code des Problems
Mandix
und was soll ich statt dessen nehmen? brauche ich da an Stelle des einen Befehls 2?
AW: Hier der Source-Code des Problems
Gerd
Ich kann mich heute nicht mehr kümmern.
Gerd

303 Forumthreads zu ähnlichen Themen

Anzeige
Anzeige
Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige