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: 25
Default Filter and immediately overwrite same sheet with results

Dear Guru's,

What would be the better / correct approach???!!! See my code below.
learning a lot through trail and error, I seem to be stuck again in
the latter: I have a macro in which I filter data, after which I want
to CopyPaste the data.value to the same sheet, overwriting what was
there. I have:

Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Worksheets(sFileNameSource01 & lRecDate).AutoFilterMode = False
Cells.Clear
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

This gives me a 1004-error: PasteSpecial Method of Range class failed.

What would be the better / correct approach???!!!

TFH, AdP

 
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
filter results to userform-sheet [email protected] Excel Programming 2 March 7th 07 03:07 PM
Save As - Can I use VBA? to stop XL Sheet overwrite Smudge Excel Discussion (Misc queries) 2 February 8th 07 01:12 AM
Why won't advanced filter return filter results? jaws4518 Excel Worksheet Functions 5 September 12th 06 06:11 PM
How do I link filter results into another sheet? aneczka Excel Worksheet Functions 0 July 7th 06 03:30 PM
Overwrite Master sheet when using merge macro Mark Jackson Excel Programming 3 June 8th 05 09:33 AM


All times are GMT +1. The time now is 01:47 PM.

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"