Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
bxc2739
 
Posts: n/a
Default what is the vb code to copy rows from one sheet to another?


Can someone please help tell me what is the correct syntax/ie vb code
to copy a entire row from one sheet to another?

Pretend I have two sheets and want to copy an entire row from sheet2
to sheet one , what is the code to do something like this?

I know I can do it manually, but for what I am doing I need
the macro code to do it automatically.

Thanks


--
bxc2739
------------------------------------------------------------------------
bxc2739's Profile: http://www.excelforum.com/member.php...o&userid=32538
View this thread: http://www.excelforum.com/showthread...hreadid=545604

  #2   Report Post  
Posted to microsoft.public.excel.misc
Ardus Petus
 
Posts: n/a
Default what is the vb code to copy rows from one sheet to another?

If you cant to copy everything (including formats):

Worksheets("Sheet2").Rows(10).Copy _
dest:=Worksheets("Sheet1").rows(10)

To copy values only:
Worksheets("Sheet1").rows(10).value = _
Worksheets("Sheet2").Rows(10).Value

HTH
--
AP

"bxc2739" a écrit
dans le message de news:
...

Can someone please help tell me what is the correct syntax/ie vb code
to copy a entire row from one sheet to another?

Pretend I have two sheets and want to copy an entire row from sheet2
to sheet one , what is the code to do something like this?

I know I can do it manually, but for what I am doing I need
the macro code to do it automatically.

Thanks


--
bxc2739
------------------------------------------------------------------------
bxc2739's Profile:
http://www.excelforum.com/member.php...o&userid=32538
View this thread: http://www.excelforum.com/showthread...hreadid=545604



  #3   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default what is the vb code to copy rows from one sheet to another?

You gonna be pasting at the bottom of a group of rows???

Can you pick out a column that has data in it if that row is used?

dim myCell as range
dim NextRow as long
dim DestCell as range

with worksheets("sheet1")
set mycell = .range("b72") 'some cell
end with

with worksheets("sheet2")
nextrow = .cells(.rows.count,"G").end(xlup).row + 1
set destcell = .cells(nextrow,"A")
end with

mycell.entirerow.copy _
destination:=destcell



bxc2739 wrote:

Can someone please help tell me what is the correct syntax/ie vb code
to copy a entire row from one sheet to another?

Pretend I have two sheets and want to copy an entire row from sheet2
to sheet one , what is the code to do something like this?

I know I can do it manually, but for what I am doing I need
the macro code to do it automatically.

Thanks

--
bxc2739
------------------------------------------------------------------------
bxc2739's Profile: http://www.excelforum.com/member.php...o&userid=32538
View this thread: http://www.excelforum.com/showthread...hreadid=545604


--

Dave Peterson
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
Lookup function and compare Student Excel Discussion (Misc queries) 8 April 25th 06 03:11 PM
resetting last cell jagdish.eashwar Excel Discussion (Misc queries) 11 March 31st 06 02:06 AM
Formula to copy rng of cells where (value is met) to anther sheet Exit Advantage Excel Worksheet Functions 3 November 12th 05 02:59 AM
Copy an additional row based on another sheet Mindie Excel Discussion (Misc queries) 5 October 19th 05 02:47 AM
Adding Rows to Master Sheet Excel Newbie New Users to Excel 1 December 23rd 04 10:56 PM


All times are GMT +1. The time now is 12:36 AM.

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"