Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default why won't this vba work, when this one does...

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default why won't this vba work, when this one does...

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
"Calle" wrote in message
...
| 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default why won't this vba work, when this one does...

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)
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default why won't this vba work, when this one does...

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

Calle wrote:

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)


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default why won't this vba work, when this one does...

I get error 400.


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default why won't this vba work, when this one does...

Which line?

What's in A1 of worksheet(1)? What's in the cells under A1?



Calle wrote:

I get error 400.


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default why won't this vba work, when this one does...

Try saving your workbook. Close excel. Open Excel, open your workbook and
try again.

--
Regards,
Tom Ogilvy

"Calle" wrote in message
...
I get error 400.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to update a column in a work based on another work sheet WickerMan New Users to Excel 1 December 4th 09 12:58 PM
how can i automatically generate work order numbers from work orde rob h Excel Discussion (Misc queries) 1 July 13th 09 07:59 PM
flash object dont work in my excel work sheet Nitn Excel Discussion (Misc queries) 0 July 4th 09 08:00 AM
If I have a work sheet protected and try to run a macro to hide rows or columns it won't work. Correct? Marc Excel Programming 2 July 12th 06 04:10 AM
Is there away to keep "auto save" from jumping to the first work sheet in the work book? Marc New Users to Excel 2 April 21st 05 01:27 AM


All times are GMT +1. The time now is 11:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"