ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy data to next available row (https://www.excelbanter.com/excel-programming/368865-copy-data-next-available-row.html)

TimN

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!

Die_Another_Day

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!



TimN

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!




TimN

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!




Ron de Bruin

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!




Die_Another_Day

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!





Simon Lloyd[_843_]

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



All times are GMT +1. The time now is 06:17 AM.

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