Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Adding a new row with a macro

Hi,

This may be a relatively simple question, but I'm having some trouble with
the programing behind it...

What I want to do is to use a macro to copy data from one one sheet to
another. Once the data is copied onto the other sheet, the next time you use
the macro, it would automatically make a new row of data instead of
overwriting the existing row. How would I do that?

--
-Mike
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default Adding a new row with a macro

Here is some generic code to do what you have asked. Note that the
destination is determined by coming up from the bottom of Column A to the
first populated cell and moving down one row from there.

Sub test()
Sheets("Sheet1").Range("A1:E1").Copy _
Destination:=Sheets("Sheet2").Cells(Rows.Count,
"A").End(xlUp).Offset(1, 0)
End Sub
--
HTH...

Jim Thomlinson


"Dobbs734" wrote:

Hi,

This may be a relatively simple question, but I'm having some trouble with
the programing behind it...

What I want to do is to use a macro to copy data from one one sheet to
another. Once the data is copied onto the other sheet, the next time you use
the macro, it would automatically make a new row of data instead of
overwriting the existing row. How would I do that?

--
-Mike

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Adding a new row with a macro

Thanks Jim,

Although, this did not solve my problem I understand the generic code you
gave me. Specifically what I need is column of data to be copied onto
another sheet where it will be transposed on a row. Then, as I stated before,
to add a new row eachtime that macro is used.

I changed the "sheets" names to the ones I used and changed the "A1:E1" to
the fields I want copied. The error occurs with the "A" after the "Count"
entry, which reads:

"Compile Error: Expected: line number or label or statement or end of
statement"

Any idea of what may be happening?

Thanks again.

--
-Mike


"Jim Thomlinson" wrote:

Here is some generic code to do what you have asked. Note that the
destination is determined by coming up from the bottom of Column A to the
first populated cell and moving down one row from there.

Sub test()
Sheets("Sheet1").Range("A1:E1").Copy _
Destination:=Sheets("Sheet2").Cells(Rows.Count,
"A").End(xlUp).Offset(1, 0)
End Sub
--
HTH...

Jim Thomlinson


"Dobbs734" wrote:

Hi,

This may be a relatively simple question, but I'm having some trouble with
the programing behind it...

What I want to do is to use a macro to copy data from one one sheet to
another. Once the data is copied onto the other sheet, the next time you use
the macro, it would automatically make a new row of data instead of
overwriting the existing row. How would I do that?

--
-Mike

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
Adding to a Macro Steven Excel Discussion (Misc queries) 2 December 15th 08 06:21 PM
Adding code to a macro Excel Helps Excel Worksheet Functions 2 January 23rd 08 06:15 PM
Macro for adding more sheets Dom Excel Discussion (Misc queries) 1 April 30th 06 06:16 AM
Adding a Tab in a Macro [email protected] Excel Discussion (Misc queries) 10 February 28th 06 09:57 PM
Adding Row to this macro Nigel Excel Discussion (Misc queries) 2 May 4th 05 05:27 PM


All times are GMT +1. The time now is 01:35 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"