MrExcel Publishing
Your One Stop for Excel Tips & Solutions

what's going wrong


Posted by amroo on May 07, 2001 1:53 AM

Bonjour, as Mr Grey Matter suggested about the using of Select, I correct my code but here I can't go forward.
My first code was
Sheets("data").select
Range("A38").select
etc...
Now here it is
'""""""""""""""""""""""""""""""""""
Sheets("data").Range("A38").Select
'"""""""""""""""""""""""""""""""""""
Do While ActiveCell.value <> ""
Selection.Offset(1, 0).Select
If ActiveCell = "" Then GoTo msg
ActiveCell.EntireRow.Copy
Sheets("prog").Range("A9").PasteSpecial
'"""""""""""""""""""""""""""""""""""""""""""
An error message says that the methode Select failled, I change it by Activate same error.
I want to learn teacher!!
A+mroo


Posted by Dave Hawley on May 07, 2001 2:06 AM


Hi Amroo, grey hair here :o)


Seems like you don't need a Loop for this, try this code instead:

Sheets("data").Range("A38").End(xlDown).EntireRow.Copy _
Destination:=Sheets("prog").Range("A9")
Application.CutCopyMode = False

This will copy the first entire row after A38 that has a blank cell below it. If you wanted the very last cell in Column A that has data in it use:

Sheets("data").Range("A65536").End(xlUp).EntireRow.Copy _
Destination:=Sheets("prog").Range("A9")
Application.CutCopyMode = False


Dave


OzGrid Business Applications

Posted by amroo on May 07, 2001 4:42 AM

Bonjour,
Since Mr D.H said that in a same workbook no need to select or activate ,I have this part of code ,
Windows("CR022.xls").Activate
Sheets("prog").Cells.Copy
Windows("ClinMars.xls").Activate
Range("A1").PasteSpecial
I want to concatenate it as this
Windows("CR022.xls").Sheets("prog").Cells.Copy
Windows("ClinMars.xls").Range("A1").PasteSpecial
An error message put me trying different solutions, but I'm hangry and my synapse don't speed at 12h.
Is it a good syntax for what my brain want?
A+mroo