Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
RB RB is offline
external usenet poster
 
Posts: 20
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 504
Default Copying data

Try this

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


  #6   Report Post  
Posted to microsoft.public.excel.programming
RB RB is offline
external usenet poster
 
Posts: 20
Default 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.


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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.


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
Copying rows of data into new worksheet but placing data into colu Thalarctos Excel Discussion (Misc queries) 0 June 6th 10 04:01 AM
Comparing data between sheets, and copying rows with data Fleone Excel Programming 1 June 2nd 06 06:54 PM
Copying data as static as source data changes pfrost Excel Worksheet Functions 3 March 13th 06 02:52 PM
Copying Data into Column with Existing Data GZul Excel Discussion (Misc queries) 0 February 9th 06 11:30 PM
Copying data down to next dirty cell, then copying that data slarson Excel Programming 0 September 15th 03 09:19 PM


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