LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mia Mia is offline
external usenet poster
 
Posts: 101
Default VBA when copying and pasting

Hi,

I have a problem with copying and pastig.

I have wrote a code wich copies a table after sorting it and pastes i in
to a new workbok. Everything works fine when I'm standing in the
table and runs the macro, but if I'm standing above the table
it copies all the rows and not only the filtered ones.

What have I done wrong? Do anyone knows?
My code a

Sheets("A").Unprotect
Application.ScreenUpdating = False

Dim bok As Workbook
Dim blad As Worksheet
Dim Period As Date
Dim Avslut As Date

Dim Rapportmånad As String
Rapportmånad = ActiveSheet.Range("B3")

Set bok = Workbooks.Add

Workbooks("C").Sheets("Adata").Activate

Period = ActiveSheet.Range("b3")
Avslut = ActiveSheet.Range("B4")

ActiveSheet.ListObjects("Atabell").Range.AutoFilte r

ActiveSheet.ListObjects("Atabell").Range.AutoFilte r Field:=21, Criteria1 _
:="<=" & Range("b3").Value, Operator:=xlOr, Criteria2 _
:="="

ActiveSheet.ListObjects("Atabell").Range.AutoFilte r Field:=23, Criteria1 _
:="" & Range("b4").Value, Operator:=xlOr, Criteria2 _
:="="

ActiveSheet.ListObjects("Atabell").Range.AutoFilte r Field:=2, Criteria1 _
:="3919"

ActiveSheet.ListObjects("Astratabell").AutoFilter. Range.Copy

bok.Activate

Set blad = Worksheets.Add()
blad.Name = "3919"

Worksheets("3919").Range("A1").PasteSpecial (xlPasteFormats)
Worksheets("3919").Range("A1").PasteSpecial (xlPasteValues)

I asked the question before but forgot information, I cross my fingers that
someone can help med.


--
Best regards
Mia
 
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
Copying and Pasting Minnie Excel Discussion (Misc queries) 10 December 11th 08 02:53 PM
Copying and Pasting Kokomo Excel Discussion (Misc queries) 1 November 20th 07 02:14 PM
Copying and Pasting Gordon[_2_] Excel Programming 8 March 9th 07 07:42 PM
Copying and Pasting Tia Excel Discussion (Misc queries) 4 June 6th 05 08:54 PM
Copying and pasting bambam77[_15_] Excel Programming 1 October 19th 04 05:05 PM


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