Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I would like to create a macro that copies and pastes data from 1 worksheet
to another, but each time it is run it records the data in a new row. Any help appreciated. |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Given that you haven't over-explained your question here's a solution you may
be able to build on. It's worksheet code and goes in the sheet you want to copy the data from Sub stance() Dim MyRange As Range Dim CopyRange As Range lastrow = Cells(Cells.Rows.Count, "A").End(xlUp).Row Set MyRange = Range("A1:A" & lastrow) For Each C In MyRange If UCase(C.Value) = "SOMEVALUE" Then If CopyRange Is Nothing Then Set CopyRange = C.EntireRow Else Set CopyRange = Union(CopyRange, C.EntireRow) End If End If Next If Not CopyRange Is Nothing Then lastrow = Sheets("Sheet2").Cells(Cells.Rows.Count, "A").End(xlUp).Row CopyRange.Copy Sheets("Sheet2").Range("A" & lastrow + 1) End If End Sub Mike "TX_AGS" wrote: I would like to create a macro that copies and pastes data from 1 worksheet to another, but each time it is run it records the data in a new row. Any help appreciated. |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
The following macro will copy the first row of the source sheet to the next
available row of the destination sheet: Sub ags() Dim ss As Worksheet, sd As Worksheet Set ss = Sheets("source") Set sd = Sheets("destination") n = sd.Cells(Rows.Count, "A").End(xlUp).Row + 1 ss.Range("1:1").Copy Destination:=sd.Range("A" & n) End Sub -- Gary''s Student - gsnu200810 "TX_AGS" wrote: I would like to create a macro that copies and pastes data from 1 worksheet to another, but each time it is run it records the data in a new row. Any help appreciated. |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Try
Sub copy1() Dim lastRow As Long lastRow = Worksheets("Sheet2").Cells(Worksheets("Sheet2").Ro ws.Count, "A").End(xlUp).Row Worksheets("Sheet1").UsedRange.Copy Worksheets("Sheet2").Activate Range("A" & (lastRow + 1)).Select ActiveSheet.Paste End Sub "TX_AGS" wrote: I would like to create a macro that copies and pastes data from 1 worksheet to another, but each time it is run it records the data in a new row. Any help appreciated. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macros: can you copy macros from one doc to another? | Excel Discussion (Misc queries) | |||
Excel 2007 macros - how to merge 5 macros together into one | Excel Discussion (Misc queries) | |||
Macros warning always shows up, even if all macros removed | Excel Discussion (Misc queries) | |||
Macros - copying macros from one computer to another | Excel Discussion (Misc queries) | |||
Training: More on how to use macros in Excel: Recording Macros | Excel Worksheet Functions |