View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rob van Gelder[_4_] Rob van Gelder[_4_] is offline
external usenet poster
 
Posts: 1,236
Default Problem pasting a row from a hidden sheet to the first free row on another visible sheet

Didier,

This will replace your .Copy, .Select, .Paste lines of code

Sheets("POINTDATA").Rows("101:101").Copy Sheets("MAP").Rows(LastRow)

Rob

"Didier Poskin" wrote in message
...
Hello you all and thank you again for the help I already got in the past.

here is the stuff:
sheet ("POINTDATA") is hidden
sheet("MAP") is visible

depending on NewElem I'm trying to copy row 101,102 or 103 from sheet
("POINTDATA") to the first free row available on sheet("MAP") but I always
get stuck on something

Private Sub CreateElement()

Dim LastRow As String

NbEl = param("Elements") ' returns the number of lines used
LastRow = Format(NbEl + 1) & ":" & Format(NbEl + 1)
...
Select Case NewElem
Case "A"
Sheets("POINTDATA").Rows("101:101").Copy
Sheets("MAP").Rows(LastRow).Select ' here it gives a

1004
error
Selection.Paste
Case "B"
...

furthermore is there a way of doing this without having to use ".select"
because this macro is called from a third sheet where there might be a non
contiguous range selected which I don't want to loose?

Thanks

Didier


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.560 / Virus Database: 352 - Release Date: 8/01/2004