Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Copy and Paste in the first empty available line.

Hello All,

I am starting to write a VBa code in order to copy 4 cells on the same line
in another sheet in order to keep the history. Right now, the present code
below just overwrite the previous data everytime I run it. I would like to be
able to have Excel copy on the next available empty line below the previous
one. How should I change my code?

Sub CopyandPaste()
Dim CopyRange As Range
Set CopyRange = Range("B5:D5")
CopyRange.Copy Destination:=Worksheets("Hist").Range("B7:D7")
End Sub

Thanks for your help.

Etienne
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 168
Default Copy and Paste in the first empty available line.

This isn't test...so give it a shot.

Sub CopyandPaste()
Dim CopyRange As Range
Set CopyRange = Range("B5:D5")
CopyRange.Copy Destination:=Worksheets("Hist") _
.Range("B" & (Range("B65536").End(xlUp).Row) & ":D" &
(Range("B65536").End(xlUp).Row))
End Sub


"Etienne" wrote in message
...
Hello All,

I am starting to write a VBa code in order to copy 4 cells on the same
line
in another sheet in order to keep the history. Right now, the present code
below just overwrite the previous data everytime I run it. I would like to
be
able to have Excel copy on the next available empty line below the
previous
one. How should I change my code?

Sub CopyandPaste()
Dim CopyRange As Range
Set CopyRange = Range("B5:D5")
CopyRange.Copy Destination:=Worksheets("Hist").Range("B7:D7")
End Sub

Thanks for your help.

Etienne



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Copy and Paste in the first empty available line.

I get an error message of compiling at &":D"

Do you know why?

Thanks,

"PCLIVE" wrote:

This isn't test...so give it a shot.

Sub CopyandPaste()
Dim CopyRange As Range
Set CopyRange = Range("B5:D5")
CopyRange.Copy Destination:=Worksheets("Hist") _
.Range("B" & (Range("B65536").End(xlUp).Row) & ":D" &
(Range("B65536").End(xlUp).Row))
End Sub


"Etienne" wrote in message
...
Hello All,

I am starting to write a VBa code in order to copy 4 cells on the same
line
in another sheet in order to keep the history. Right now, the present code
below just overwrite the previous data everytime I run it. I would like to
be
able to have Excel copy on the next available empty line below the
previous
one. How should I change my code?

Sub CopyandPaste()
Dim CopyRange As Range
Set CopyRange = Range("B5:D5")
CopyRange.Copy Destination:=Worksheets("Hist").Range("B7:D7")
End Sub

Thanks for your help.

Etienne




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Copy and Paste in the first empty available line.

Sorry, I made an error typing.

Yet, the macro works but keeps on overwriting the previous data. Excel does
not copy on the next available line.

Etienne

"PCLIVE" wrote:

This isn't test...so give it a shot.

Sub CopyandPaste()
Dim CopyRange As Range
Set CopyRange = Range("B5:D5")
CopyRange.Copy Destination:=Worksheets("Hist") _
.Range("B" & (Range("B65536").End(xlUp).Row) & ":D" &
(Range("B65536").End(xlUp).Row))
End Sub


"Etienne" wrote in message
...
Hello All,

I am starting to write a VBa code in order to copy 4 cells on the same
line
in another sheet in order to keep the history. Right now, the present code
below just overwrite the previous data everytime I run it. I would like to
be
able to have Excel copy on the next available empty line below the
previous
one. How should I change my code?

Sub CopyandPaste()
Dim CopyRange As Range
Set CopyRange = Range("B5:D5")
CopyRange.Copy Destination:=Worksheets("Hist").Range("B7:D7")
End Sub

Thanks for your help.

Etienne




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Copy and Paste in the first empty available line.

See
http://www.rondebruin.nl/copy1.htm

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Etienne" wrote in message ...
Sorry, I made an error typing.

Yet, the macro works but keeps on overwriting the previous data. Excel does
not copy on the next available line.

Etienne

"PCLIVE" wrote:

This isn't test...so give it a shot.

Sub CopyandPaste()
Dim CopyRange As Range
Set CopyRange = Range("B5:D5")
CopyRange.Copy Destination:=Worksheets("Hist") _
.Range("B" & (Range("B65536").End(xlUp).Row) & ":D" &
(Range("B65536").End(xlUp).Row))
End Sub


"Etienne" wrote in message
...
Hello All,

I am starting to write a VBa code in order to copy 4 cells on the same
line
in another sheet in order to keep the history. Right now, the present code
below just overwrite the previous data everytime I run it. I would like to
be
able to have Excel copy on the next available empty line below the
previous
one. How should I change my code?

Sub CopyandPaste()
Dim CopyRange As Range
Set CopyRange = Range("B5:D5")
CopyRange.Copy Destination:=Worksheets("Hist").Range("B7:D7")
End Sub

Thanks for your help.

Etienne








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Copy and Paste in the first empty available line.

Perfect.

Thanks a lot for your help.

Etienne

"Ron de Bruin" wrote:

See
http://www.rondebruin.nl/copy1.htm

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Etienne" wrote in message ...
Sorry, I made an error typing.

Yet, the macro works but keeps on overwriting the previous data. Excel does
not copy on the next available line.

Etienne

"PCLIVE" wrote:

This isn't test...so give it a shot.

Sub CopyandPaste()
Dim CopyRange As Range
Set CopyRange = Range("B5:D5")
CopyRange.Copy Destination:=Worksheets("Hist") _
.Range("B" & (Range("B65536").End(xlUp).Row) & ":D" &
(Range("B65536").End(xlUp).Row))
End Sub


"Etienne" wrote in message
...
Hello All,

I am starting to write a VBa code in order to copy 4 cells on the same
line
in another sheet in order to keep the history. Right now, the present code
below just overwrite the previous data everytime I run it. I would like to
be
able to have Excel copy on the next available empty line below the
previous
one. How should I change my code?

Sub CopyandPaste()
Dim CopyRange As Range
Set CopyRange = Range("B5:D5")
CopyRange.Copy Destination:=Worksheets("Hist").Range("B7:D7")
End Sub

Thanks for your help.

Etienne






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
Macro - Copy/Paste Special to Next Blank Line lajohn63 New Users to Excel 2 August 27th 12 09:27 PM
Line copy - Not just a simple copy paste Ninerref Excel Worksheet Functions 3 September 10th 09 11:44 AM
IN EXCEL...I CANNOT COPY THE TOTAL LINE AND PASTE IT ...I GET REF. wg pollard Excel Worksheet Functions 1 November 8th 04 04:26 PM
macro to copy paste non empty data paritoshmehta[_22_] Excel Programming 0 July 1st 04 09:17 PM
Macro to Copy/Paste then Paste to Next Line tomkarakowski Excel Programming 1 May 28th 04 01:19 AM


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