LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default Insert Rows if Pasting more Than 1 Row

Hi,

I'm trying to copy and paste filtered data on Wksht A into a report on Wksht
B. The number of lines in the filtered range on Wksht A will vary for each
report.

The upper left paste location on Wkst B is a cell named SpecDate.

I want to insert extra complete rows if the filtered data is greater than 1
row. This is because I have other report sections below the destination that
I wish to push down.

I've tried a few ways, but to no avail. This is my latest attempt - I don't
get errors but nothing pastes. I'm *not* great in VBA, as you can see.
Thanks!

Dim rng As Range, i As Long

Set rng = ActiveCell.CurrentRegion
rng.Select
i = rng.Rows.Count

rng.Copy
Application.Goto Reference:="SpecDate"

If i = 1 Then
rng.PasteSpecial Paste:=xlPasteAll
Else
ActiveCell.EntireRow.Resize(rowsize:=i - 1).Insert Shift:=xlDown
rng.PasteSpecial Paste:=xlPasteAll
End If


 
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
Copy pasting Rows, but need to Delete any Shapes/Pictures that are within copied rows Corey Excel Programming 2 August 1st 07 02:02 AM
Pasting rows below the last row with data? flurry[_4_] Excel Programming 2 May 16th 06 12:24 PM
how do I insert a blank row when pasting? mimmo Excel Discussion (Misc queries) 0 February 3rd 06 06:18 PM
Pasting in Rows? FattyLumpkin Excel Discussion (Misc queries) 6 July 24th 05 04:56 PM
Pasting formulas to different rows herbertgroover Excel Worksheet Functions 1 January 20th 05 06:29 PM


All times are GMT +1. The time now is 01:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"