ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copying data (https://www.excelbanter.com/excel-programming/403252-copying-data.html)

RB

Copying data
 
Hi All,

I want to copy data from one sheet to another. I have to select Col A and
as many rows that have data in it (from A1 to A32), but this has to be
dynamic becuase the rows might change. I then have to copy these selected
cells to sheet 1. I nedd the code for this. I knw the solution is simple but
cajt seem to figure out. Can somebody pls help. It will be appreciated.

Ron de Bruin

Copying data
 
Try this to copy from Sheet1 to sheet2 A1

Sheets("Sheet1").Range("A1:A" & Range( _
"A" & Rows.Count).End(xlUp).Row).Copy Sheets("Sheet2").Range("A1")


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"RB" wrote in message ...
Hi All,

I want to copy data from one sheet to another. I have to select Col A and
as many rows that have data in it (from A1 to A32), but this has to be
dynamic becuase the rows might change. I then have to copy these selected
cells to sheet 1. I nedd the code for this. I knw the solution is simple but
cajt seem to figure out. Can somebody pls help. It will be appreciated.


Ron de Bruin

Copying data
 
This one is better

Sub test()
With Sheets("Sheet1")
.Range("A1:A" & .Range( _
"A" & .Rows.Count).End(xlUp).Row).Copy Sheets("Sheet2").Range("A1")
End With
End Sub


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"RB" wrote in message ...
Hi All,

I want to copy data from one sheet to another. I have to select Col A and
as many rows that have data in it (from A1 to A32), but this has to be
dynamic becuase the rows might change. I then have to copy these selected
cells to sheet 1. I nedd the code for this. I knw the solution is simple but
cajt seem to figure out. Can somebody pls help. It will be appreciated.


Don Guillett

Copying data
 

To help in your assignment look in the archives for
last row

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"RB" wrote in message
...
Hi All,

I want to copy data from one sheet to another. I have to select Col A and
as many rows that have data in it (from A1 to A32), but this has to be
dynamic becuase the rows might change. I then have to copy these selected
cells to sheet 1. I nedd the code for this. I knw the solution is simple
but
cajt seem to figure out. Can somebody pls help. It will be appreciated.



Kevin

Copying data
 
Try this

Sub cop()
Range("A1", Range("A1").End(xlDown)).Copy _
Destination:=Worksheets("Sheet1").Range("A1")
Application.CutCopyMode = False
End Sub

RB

Copying data
 
Thanks Ron,

That solved my problem!

"Ron de Bruin" wrote:

Try this to copy from Sheet1 to sheet2 A1

Sheets("Sheet1").Range("A1:A" & Range( _
"A" & Rows.Count).End(xlUp).Row).Copy Sheets("Sheet2").Range("A1")


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"RB" wrote in message ...
Hi All,

I want to copy data from one sheet to another. I have to select Col A and
as many rows that have data in it (from A1 to A32), but this has to be
dynamic becuase the rows might change. I then have to copy these selected
cells to sheet 1. I nedd the code for this. I knw the solution is simple but
cajt seem to figure out. Can somebody pls help. It will be appreciated.



Ron de Bruin

Copying data
 
Hi RB

You are welcome

Use the other example I posted, this one is also working correct if "sheet1" is not active.


Sub test()
With Sheets("Sheet1")
.Range("A1:A" & .Range( _
"A" & .Rows.Count).End(xlUp).Row).Copy Sheets("Sheet2").Range("A1")
End With
End Sub


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"RB" wrote in message ...
Thanks Ron,

That solved my problem!

"Ron de Bruin" wrote:

Try this to copy from Sheet1 to sheet2 A1

Sheets("Sheet1").Range("A1:A" & Range( _
"A" & Rows.Count).End(xlUp).Row).Copy Sheets("Sheet2").Range("A1")


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"RB" wrote in message ...
Hi All,

I want to copy data from one sheet to another. I have to select Col A and
as many rows that have data in it (from A1 to A32), but this has to be
dynamic becuase the rows might change. I then have to copy these selected
cells to sheet 1. I nedd the code for this. I knw the solution is simple but
cajt seem to figure out. Can somebody pls help. It will be appreciated.




All times are GMT +1. The time now is 12:53 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com