Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mia Mia is offline
external usenet poster
 
Posts: 101
Default Copy and paste

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?


--
Best regards
Mia
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Copy and paste

Mia,

What have I done wrong? Do anyone knows?



How can anyone possibly offer an informed solution unless you post your code?

Mike
--
When competing hypotheses are equal, adopt the hypothesis that introduces
the fewest assumptions while still sufficiently answering the question.


"Mia" wrote:

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?


--
Best regards
Mia

  #3   Report Post  
Posted to microsoft.public.excel.programming
Mia Mia is offline
external usenet poster
 
Posts: 101
Default Copy and paste

Sorry, here it comes




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

Dim dagar As Long
Dim AktuellLista As Range
Dim bok As Workbook
Dim blad As Worksheet
Dim rad As Long

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("Abell").Range.AutoFilter 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)


--
Best regards
Mia


"Mike H" skrev:

Mia,

What have I done wrong? Do anyone knows?



How can anyone possibly offer an informed solution unless you post your code?

Mike
--
When competing hypotheses are equal, adopt the hypothesis that introduces
the fewest assumptions while still sufficiently answering the question.


"Mia" wrote:

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?


--
Best regards
Mia

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
Can't Copy and Paste or Paste Special between Excel Workbooks wllee Excel Discussion (Misc queries) 5 April 29th 23 03:43 AM
Automating copy/paste/paste special when row references change Carl LaFong Excel Programming 4 October 8th 07 06:10 AM
help w/ generic copy & paste/paste special routine DavidH[_2_] Excel Programming 5 January 23rd 06 03:58 AM
Excel cut/Paste Problem: Year changes after data is copy and paste Asif Excel Discussion (Misc queries) 2 December 9th 05 05:16 PM
Copy and Paste macro needs to paste to a changing cell reference loulou Excel Programming 0 February 24th 05 10:29 AM


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