LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Insert Row/Copy with Autofilter

I have a macro that copies the active cell's row and pastes it in the row
below it. It then deletes certain columns of data from the new row that was
pasted. However, I've noticed that it does not work when I the data is
filtered. It only inserts a blank row. Is there any way to get this to work
with the data filtered?

Sub InsertRowCopyDownwDelete()

ActiveSheet.Unprotect

ActiveCell.EntireRow.Select
Selection.Copy
ActiveCell.Offset(1, 0).EntireRow.Select
Selection.Insert Shift:=xlDown
Application.CutCopyMode = False

Dim ClearRange As Range
Dim Area As Range
Dim RowNumber As Variant

Set ClearRange = Range("I:I,L:L,N:P,T:DK")
RowNumber = ActiveCell.Row
If RowNumber 1 Then
For Each Area In ClearRange.Areas
Area.Rows(RowNumber).ClearContents
Next Area
End If
ActiveCell.Activate

Set ClearRange = Nothing
Set Area = Nothing

ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True _
, AllowInsertingRows:=True, AllowInsertingHyperlinks:=True,
AllowFiltering _
:=True


End Sub
 
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 to insert formula using Autofilter [email protected] Excel Discussion (Misc queries) 0 February 20th 07 05:32 PM
Copy function across autofilter dd Excel Worksheet Functions 13 January 18th 07 07:03 PM
Copy to visible cell after Autofilter Hank Excel Discussion (Misc queries) 4 July 6th 06 04:33 PM
Autofilter - copy & paste Dorothy Excel Worksheet Functions 0 May 29th 06 10:56 PM
Copy/Paste in Autofilter honyacker Excel Discussion (Misc queries) 2 January 12th 06 02:38 PM


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