Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Paste selection minus the first row....

Hi there,

I have code that copies from a sheet to a new sheet in a different
workbook. It's doing appends onto the same sheet. For the first
paste I want to paste everything, but for the second paste, I want to
paste everything minus the first row, which is a header row. In the
Else how do I tell VBA to ActiveSheet.Paste (-1) ????

This If-Then-Else

If lastrow2 = 1 Then
ActiveSheet.Paste
Else
real = lastrow2 + 1
Range("A" & real).Select
ActiveSheet.Paste
End If

Thanks for the help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Paste selection minus the first row....

You'll have to change the range that should be copied. Just avoid that topmost
row.


With RngToCopy
set rngtocopy = .resize(.rows.count-1).offset(1,0)
end with

This may even work???



RompStar wrote:

Hi there,

I have code that copies from a sheet to a new sheet in a different
workbook. It's doing appends onto the same sheet. For the first
paste I want to paste everything, but for the second paste, I want to
paste everything minus the first row, which is a header row. In the
Else how do I tell VBA to ActiveSheet.Paste (-1) ????

This If-Then-Else

If lastrow2 = 1 Then
ActiveSheet.Paste
Else
real = lastrow2 + 1
Range("A" & real).Select
ActiveSheet.Paste
End If

Thanks for the help.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 421
Default Paste selection minus the first row....

Hi RompStar,

I am not sure what your code is doing.

However, as example of a method of
returning a range without its header row,
try something like

'=========
Public Sub Tester()
Dim Rng As Range
Dim Rng2 As Range

Set Rng = Range("A1:D10")

With Rng
Set Rng2 = .Offset(1).Resize(.Rows.Count - 1)
End With

MsgBox Rng2.Address(0, 0)

End Sub
'<<=========



---
Regards.
Norman


"RompStar" wrote in message
...
Hi there,

I have code that copies from a sheet to a new sheet in a different
workbook. It's doing appends onto the same sheet. For the first
paste I want to paste everything, but for the second paste, I want to
paste everything minus the first row, which is a header row. In the
Else how do I tell VBA to ActiveSheet.Paste (-1) ????

This If-Then-Else

If lastrow2 = 1 Then
ActiveSheet.Paste
Else
real = lastrow2 + 1
Range("A" & real).Select
ActiveSheet.Paste
End If

Thanks for the help.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Paste selection minus the first row....

COol, I will give that a shot, thanks a lot!
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
How to change all cells from minus to plus and plus to minus Rockbear Excel Worksheet Functions 4 April 3rd 23 04:28 PM
Copy Selection - Paste Selection - Delete Selection Uninvisible Excel Programming 2 October 25th 07 01:31 PM
Paste into autofilter selection! HenrikB Excel Worksheet Functions 1 September 21st 06 09:29 AM
CHANGE TRAILING MINUS TO BRACKETS OR PRECEEDING MINUS Socal Analyst looking for help Excel Discussion (Misc queries) 2 May 12th 06 07:17 PM
paste selection?? Douvid Excel Programming 2 August 20th 03 10:37 PM


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