Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 2
Default Copy and paste from one tab to another with certain rules using VBA

Hi. I need a code that does the following please. Copy and pastes a row from tab 1 (“April”) to tab 2 (“May”). However if there’s a ‘0’ in column H then I only want it to paste the row from column B onwards. If there’s a ‘1’ in column H, I need it to copy and paste the entire row. I’d also like it to paste in the row same on the 2nd tab. For example if its in row 5 on tab 1 I’d like it to appear in row 5 on tab 2. I’d like it also to appear automatically in the 2nd tab after inputting the number 0 or 1 into the column H. Hope this all makes sense.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Copy and paste from one tab to another with certain rules using VBA

Hi,

Am Tue, 16 Apr 2013 16:20:29 +0100 schrieb missexcel12:

Hi. I need a code that does the following please. Copy and pastes a row
from tab 1 (“April”) to tab 2 (“May”). However if there’s a ‘0’ in
column H then I only want it to paste the row from column B onwards. If
there’s a ‘1’ in column H, I need it to copy and paste the entire row.
I’d also like it to paste in the row same on the 2nd tab. For example if
its in row 5 on tab 1 I’d like it to appear in row 5 on tab 2. I’d like
it also to appear automatically in the 2nd tab after inputting the
number 0 or 1 into the column H. Hope this all makes sense.


copy the sheet and name the copy "May". And then delete the cells in A
if in H is 0


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
  #3   Report Post  
Junior Member
 
Posts: 2
Default

Hi. Thanks for this. Unfortunately I need a code to complete this automatically as the tabs are already set up with other formulas.



Quote:
Originally Posted by Claus Busch View Post
Hi,

Am Tue, 16 Apr 2013 16:20:29 +0100 schrieb missexcel12:

Hi. I need a code that does the following please. Copy and pastes a row
from tab 1 (“April”) to tab 2 (“May”). However if there’s a ‘0’ in
column H then I only want it to paste the row from column B onwards. If
there’s a ‘1’ in column H, I need it to copy and paste the entire row.
I’d also like it to paste in the row same on the 2nd tab. For example if
its in row 5 on tab 1 I’d like it to appear in row 5 on tab 2. I’d like
it also to appear automatically in the 2nd tab after inputting the
number 0 or 1 into the column H. Hope this all makes sense.


copy the sheet and name the copy "May". And then delete the cells in A
if in H is 0


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Copy and paste from one tab to another with certain rules using VBA

Hi,

Am Wed, 17 Apr 2013 09:58:41 +0100 schrieb missexcel12:

Hi. Thanks for this. Unfortunately I need a code to complete this
automatically as the tabs are already set up with other formulas.


try:

Sub CopyAndDelete()
Dim LRow As Long

Sheets("April").Copy After:=Sheets("April")
With ActiveSheet
.Name = "Mai"
LRow = .Cells(.Rows.Count, "H").End(xlUp).Row
.Range("A1:H" & LRow).AutoFilter Field:=8, Criteria1:=0
.Range("A2:A" & LRow).ClearContents
.AutoFilterMode = False
End With
End Sub


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
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 loses order of Conditional Formatting rules HM Excel Discussion (Misc queries) 1 May 4th 10 08:25 PM
Paste conditional formatting rules Ted M H Excel Discussion (Misc queries) 0 May 21st 08 06:48 PM
how do I set up a validation rules with two data rules Trudy Excel Worksheet Functions 1 October 16th 06 05:42 AM
Tool / Code to copy and paste only the conditional formatting rules Andibevan Excel Programming 0 August 9th 06 12:01 PM
Excel cut/Paste Problem: Year changes after data is copy and paste Asif Excel Discussion (Misc queries) 2 December 9th 05 05:16 PM


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