Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default copy and paste in different columns with conditions

Hello guys
I have two sheets. In the first sheet there is a table with data
contained in five columns (A;B;C;D;E).In the second sheet there is
another table with data contained in five columns. I would like to copy
some cells present in columns A,B,D of the the second sheet in the
colums B,C,D of the first sheet, below the data already present.The
data to copy in the first sheet are only those which have in column E
of the second sheet the text "#D/N".
I attache a file whit the example (in the file there are few rows..but
the macro should run independently of number of rows)
Thanks in advance for your help
Bye

Attachment filename: prova1.xls
Download attachment: http://www.excelforum.com/attachment.php?postid=426940
---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default copy and paste in different columns with conditions

I didn't, and won't, open your workbook, but based on your description
this may work for you:


Public Sub CopyDNs()
Dim rDest As Range
Application.ScreenUpdating = False
Set rDest = Sheets("Sheet1").Range( _
"B" & Rows.Count).End(xlUp).Offset(1, 0)
With Sheets("Sheet2")
.Range("A:E").AutoFilter _
Field:=5, _
Criteria1:="#D/N"
On Error Resume Next
With .Range("A2:D" & .Range("E" & _
Rows.Count).End(xlUp).Row).SpecialCells(xlCellType Visible)
.Copy Destination:=rDest
rDest.Offset(0, 2).Resize(.Count, 1).Delete _
Shift:=xlToLeft
End With
.AutoFilterMode = False
End With
Application.ScreenUpdating = True
End Sub


In article ,
71marco71 wrote:

Hello guys
I have two sheets. In the first sheet there is a table with data
contained in five columns (A;B;C;D;E).In the second sheet there is
another table with data contained in five columns. I would like to copy
some cells present in columns A,B,D of the the second sheet in the
colums B,C,D of the first sheet, below the data already present.The
data to copy in the first sheet are only those which have in column E
of the second sheet the text "#D/N".
I attache a file whit the example (in the file there are few rows..but
the macro should run independently of number of rows)
Thanks in advance for your help
Bye

Attachment filename: prova1.xls
Download attachment: http://www.excelforum.com/attachment.php?postid=426940

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
copy conditional formatting, paste format without conditions jasonr17 Excel Discussion (Misc queries) 6 May 2nd 08 05:52 PM
copy and paste visible columns ferde Excel Discussion (Misc queries) 1 December 8th 05 08:42 AM
Why can't a copy and paste columns? Nicole L. Excel Worksheet Functions 3 February 10th 05 06:55 PM
Copy/Paste of separated columns mareku Excel Discussion (Misc queries) 2 January 5th 05 10:04 PM
copy and paste in different columns with conditions 71marco71 Excel Programming 1 January 27th 04 06:03 PM


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