why won't this vba work, when this one does...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

works:
Set sourceRange = mybook.Worksheets(1).Rows("1:150")
Set destrange = basebook.Worksheets("import").Rows(Lr)
That code copies row 1-150 and paste it into the first empty row, however I
want it to copy all rows that is not empty...

doesn't wrok:
Set sourceRange = mybook.Worksheets(1).Columns("A:K")
Set destrange = basebook.Worksheets("import").Rows(Lr)
I want it to copy column A-K and paste it into the first empty row
 
You can only copy an entire column into an entire column. If you do not
actually want to copy an entire column then refine the source range to match
the range of data to be copied.

--
Jim
| works:
| Set sourceRange = mybook.Worksheets(1).Rows("1:150")
| Set destrange = basebook.Worksheets("import").Rows(Lr)
| That code copies row 1-150 and paste it into the first empty row, however
I
| want it to copy all rows that is not empty...
|
| doesn't wrok:
| Set sourceRange = mybook.Worksheets(1).Columns("A:K")
| Set destrange = basebook.Worksheets("import").Rows(Lr)
| I want it to copy column A-K and paste it into the first empty row
 
Hi!
I have tried this, but it doesnt seem to work:

Set sourceRange = mybook.Worksheets(1).Rows("A1",
Range("A1").End(xlDown)).EntireRow.Copy
Set destrange = basebook.Worksheets("import").Rows(Lr)
 
Maybe...

With myBook.Worksheets(1)
Set SourceRange = .Range("A1", .Range("a1").End(xlDown))
End With
Set DestRange = BaseBook.Worksheets("import").Rows(LR)
SourceRange.EntireRow.Copy _
Destination:=DestRange
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top