Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy data to next available row
I have looked at posts on this subject, but can't seem to get it to work for
me. At the OK command event, I want to copy cells in the Range B14:N33 in Sheet1 to the next available row in Column A of the "Data" worksheet all within the same workbook. How do I get this to work? Thanks to the Excel experts for your generous help! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy data to next available row
Sub CopyRange()
Sheets("Sheet1").Range("B14:N33").Copy Sheets("Data").Range("A1").End(xlDown).Offset(1,0) .PasteSpecial xlPasteAll End Sub HTH Die_Another_Day TimN wrote: I have looked at posts on this subject, but can't seem to get it to work for me. At the OK command event, I want to copy cells in the Range B14:N33 in Sheet1 to the next available row in Column A of the "Data" worksheet all within the same workbook. How do I get this to work? Thanks to the Excel experts for your generous help! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy data to next available row
Didn't quite work. Nothing copied over to the Data worksheet. The Data
worksheet has cells A4:M23 highlighted. The next available cell as it currently sits would be cell A61. Any thoughts? "Die_Another_Day" wrote: Sub CopyRange() Sheets("Sheet1").Range("B14:N33").Copy Sheets("Data").Range("A1").End(xlDown).Offset(1,0) .PasteSpecial xlPasteAll End Sub HTH Die_Another_Day TimN wrote: I have looked at posts on this subject, but can't seem to get it to work for me. At the OK command event, I want to copy cells in the Range B14:N33 in Sheet1 to the next available row in Column A of the "Data" worksheet all within the same workbook. How do I get this to work? Thanks to the Excel experts for your generous help! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy data to next available row
I have the following working with one exception:
Dim rCell As Range With Application.ThisWorkbook Set rCell = .Worksheets("Data").Range("A65536").End(xlUp).Offs et(1, 0) Worksheets("Sheet1").Range("B14:N33").Copy rCell.PasteSpecial Paste:=xlValues 'CutCopyMode = False End With Unload Me End Sub I have the CutCopyMode = False line commented out. Otherwise I get a Compile Error, Variable not Defined error message. However, this code works with the exception of the area I copy is still surrounded with the moving border (still selected to be copied). What am I doing wrong here? "Die_Another_Day" wrote: Sub CopyRange() Sheets("Sheet1").Range("B14:N33").Copy Sheets("Data").Range("A1").End(xlDown).Offset(1,0) .PasteSpecial xlPasteAll End Sub HTH Die_Another_Day TimN wrote: I have looked at posts on this subject, but can't seem to get it to work for me. At the OK command event, I want to copy cells in the Range B14:N33 in Sheet1 to the next available row in Column A of the "Data" worksheet all within the same workbook. How do I get this to work? Thanks to the Excel experts for your generous help! |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy data to next available row
See
http://www.rondebruin.nl/copy1.htm -- Regards Ron de Bruin http://www.rondebruin.nl "TimN" wrote in message ... I have looked at posts on this subject, but can't seem to get it to work for me. At the OK command event, I want to copy cells in the Range B14:N33 in Sheet1 to the next available row in Column A of the "Data" worksheet all within the same workbook. How do I get this to work? Thanks to the Excel experts for your generous help! |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy data to next available row
Move the CutCopyMode out of the with statement and put "Application" in
front of it Application.CutCopyMode = False Die_Another_Day TimN wrote: I have the following working with one exception: Dim rCell As Range With Application.ThisWorkbook Set rCell = .Worksheets("Data").Range("A65536").End(xlUp).Offs et(1, 0) Worksheets("Sheet1").Range("B14:N33").Copy rCell.PasteSpecial Paste:=xlValues 'CutCopyMode = False End With Unload Me End Sub I have the CutCopyMode = False line commented out. Otherwise I get a Compile Error, Variable not Defined error message. However, this code works with the exception of the area I copy is still surrounded with the moving border (still selected to be copied). What am I doing wrong here? "Die_Another_Day" wrote: Sub CopyRange() Sheets("Sheet1").Range("B14:N33").Copy Sheets("Data").Range("A1").End(xlDown).Offset(1,0) .PasteSpecial xlPasteAll End Sub HTH Die_Another_Day TimN wrote: I have looked at posts on this subject, but can't seem to get it to work for me. At the OK command event, I want to copy cells in the Range B14:N33 in Sheet1 to the next available row in Column A of the "Data" worksheet all within the same workbook. How do I get this to work? Thanks to the Excel experts for your generous help! |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy data to next available row
Paste this in to the ok event, it worked for me in a seperate module so in the OK event you could call it from a seperate module i.e Call Test Hope this helps, Simon Sub Test() Dim rng1 As Range Dim rng As Range Set rng = Range("B14:N33") rng.Copy Sheets("Data").Select Set rng1 = Worksheets("Data").Cells(Rows.Count, 1).End(xlUp)(2) rng1.Select ActiveSheet.Paste CutCopyMode = False Worksheets("Sheet1").Select End Sub -- Simon Lloyd ------------------------------------------------------------------------ Simon Lloyd's Profile: http://www.excelforum.com/member.php...fo&userid=6708 View this thread: http://www.excelforum.com/showthread...hreadid=566679 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How copy none excel data & paste in 2007 without overwriting data | Excel Discussion (Misc queries) | |||
Retrieve multiple data rows data from a very long list and copy t | Excel Discussion (Misc queries) | |||
How do I copy data from main frame computer and keep data in cell | Excel Worksheet Functions | |||
Copy old Data from web query while keeping previous days data | Excel Worksheet Functions | |||
Copy data into cells until changes trigger new copy | Excel Programming |