PC Review


Reply
Thread Tools Rate Thread

Copy IF condition exists

 
 
Office_Novice
Guest
Posts: n/a
 
      23rd Jan 2008
Is it possiable to Copy and paste if a specific condition exists?

Heres the problem in column "F" there is a number. If that number is less
then 61 i would like to move the entire row to another sheet. also the range
will change with the data. can this be done?
 
Reply With Quote
 
 
 
 
Otto Moehrbach
Guest
Posts: n/a
 
      23rd Jan 2008
Something like:
If Range("F5").Value<61 Then
'Your code to move/copy whatever you want.
End If
You will probably need more than that if you want to "move" the entire row
rather than just copy it.
HTH Otto
"Office_Novice" <(E-Mail Removed)> wrote in message
news:22F93BF4-0D03-45A1-967E-(E-Mail Removed)...
> Is it possiable to Copy and paste if a specific condition exists?
>
> Heres the problem in column "F" there is a number. If that number is less
> then 61 i would like to move the entire row to another sheet. also the
> range
> will change with the data. can this be done?



 
Reply With Quote
 
Office_Novice
Guest
Posts: n/a
 
      23rd Jan 2008
Well Thats a good start thanks, if i could bother you for one more? Rather
then spend the rest of my life typing this over and over
Sub newone()
If Range("F1").Value < 61 Then
Sheets("Sheet1").Select
Rows("1:1").Select
Selection.Copy
Sheets("Sheet2").Select
ActiveSheet.Paste
Sheets("Sheet1").Select
End If
If Range("F2").Value < 61 Then
Rows("2:2").Select
Selection.Copy
Sheets("Sheet2").Select
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
Sheets("Sheet1").Select
End If
Could this be put in a loop to Do....Until There are no numbers < 61?


"Otto Moehrbach" wrote:

> Something like:
> If Range("F5").Value<61 Then
> 'Your code to move/copy whatever you want.
> End If
> You will probably need more than that if you want to "move" the entire row
> rather than just copy it.
> HTH Otto
> "Office_Novice" <(E-Mail Removed)> wrote in message
> news:22F93BF4-0D03-45A1-967E-(E-Mail Removed)...
> > Is it possiable to Copy and paste if a specific condition exists?
> >
> > Heres the problem in column "F" there is a number. If that number is less
> > then 61 i would like to move the entire row to another sheet. also the
> > range
> > will change with the data. can this be done?

>
>
>

 
Reply With Quote
 
Otto Moehrbach
Guest
Posts: n/a
 
      23rd Jan 2008
Maybe something like this: HTH Otto
Sub newone()
Dim RngColF As Range
Dim i As Range
Dim Dest As Range
Sheets("Sheet1").Select
Set RngColF = Range("F1", Range("F" & Rows.Count).End(xlUp))
With Sheets("Sheet2")
Set Dest = .Range("A1")
End With
For Each i In RngColF
If i.Value < 61 Then
i.EntireRow.Copy Dest
Set Dest = Dest.Offset(1)
End If
Next i
End Sub
"Office_Novice" <(E-Mail Removed)> wrote in message
news:F8836CCF-C225-4C66-8DC8-(E-Mail Removed)...
> Well Thats a good start thanks, if i could bother you for one more? Rather
> then spend the rest of my life typing this over and over
> Sub newone()
> If Range("F1").Value < 61 Then
> Sheets("Sheet1").Select
> Rows("1:1").Select
> Selection.Copy
> Sheets("Sheet2").Select
> ActiveSheet.Paste
> Sheets("Sheet1").Select
> End If
> If Range("F2").Value < 61 Then
> Rows("2:2").Select
> Selection.Copy
> Sheets("Sheet2").Select
> ActiveCell.Offset(1, 0).Select
> ActiveSheet.Paste
> Sheets("Sheet1").Select
> End If
> Could this be put in a loop to Do....Until There are no numbers < 61?
>
>
> "Otto Moehrbach" wrote:
>
>> Something like:
>> If Range("F5").Value<61 Then
>> 'Your code to move/copy whatever you want.
>> End If
>> You will probably need more than that if you want to "move" the entire
>> row
>> rather than just copy it.
>> HTH Otto
>> "Office_Novice" <(E-Mail Removed)> wrote in message
>> news:22F93BF4-0D03-45A1-967E-(E-Mail Removed)...
>> > Is it possiable to Copy and paste if a specific condition exists?
>> >
>> > Heres the problem in column "F" there is a number. If that number is
>> > less
>> > then 61 i would like to move the entire row to another sheet. also the
>> > range
>> > will change with the data. can this be done?

>>
>>
>>



 
Reply With Quote
 
Office_Novice
Guest
Posts: n/a
 
      23rd Jan 2008
So Far so Good thanks Otto!

"Otto Moehrbach" wrote:

> Maybe something like this: HTH Otto
> Sub newone()
> Dim RngColF As Range
> Dim i As Range
> Dim Dest As Range
> Sheets("Sheet1").Select
> Set RngColF = Range("F1", Range("F" & Rows.Count).End(xlUp))
> With Sheets("Sheet2")
> Set Dest = .Range("A1")
> End With
> For Each i In RngColF
> If i.Value < 61 Then
> i.EntireRow.Copy Dest
> Set Dest = Dest.Offset(1)
> End If
> Next i
> End Sub
> "Office_Novice" <(E-Mail Removed)> wrote in message
> news:F8836CCF-C225-4C66-8DC8-(E-Mail Removed)...
> > Well Thats a good start thanks, if i could bother you for one more? Rather
> > then spend the rest of my life typing this over and over
> > Sub newone()
> > If Range("F1").Value < 61 Then
> > Sheets("Sheet1").Select
> > Rows("1:1").Select
> > Selection.Copy
> > Sheets("Sheet2").Select
> > ActiveSheet.Paste
> > Sheets("Sheet1").Select
> > End If
> > If Range("F2").Value < 61 Then
> > Rows("2:2").Select
> > Selection.Copy
> > Sheets("Sheet2").Select
> > ActiveCell.Offset(1, 0).Select
> > ActiveSheet.Paste
> > Sheets("Sheet1").Select
> > End If
> > Could this be put in a loop to Do....Until There are no numbers < 61?
> >
> >
> > "Otto Moehrbach" wrote:
> >
> >> Something like:
> >> If Range("F5").Value<61 Then
> >> 'Your code to move/copy whatever you want.
> >> End If
> >> You will probably need more than that if you want to "move" the entire
> >> row
> >> rather than just copy it.
> >> HTH Otto
> >> "Office_Novice" <(E-Mail Removed)> wrote in message
> >> news:22F93BF4-0D03-45A1-967E-(E-Mail Removed)...
> >> > Is it possiable to Copy and paste if a specific condition exists?
> >> >
> >> > Heres the problem in column "F" there is a number. If that number is
> >> > less
> >> > then 61 i would like to move the entire row to another sheet. also the
> >> > range
> >> > will change with the data. can this be done?
> >>
> >>
> >>

>
>
>

 
Reply With Quote
 
Otto Moehrbach
Guest
Posts: n/a
 
      23rd Jan 2008
So far so good?? You mean there's more? Otto
"Office_Novice" <(E-Mail Removed)> wrote in message
news:78FF6FA6-635F-4BC0-BA1A-(E-Mail Removed)...
> So Far so Good thanks Otto!
>
> "Otto Moehrbach" wrote:
>
>> Maybe something like this: HTH Otto
>> Sub newone()
>> Dim RngColF As Range
>> Dim i As Range
>> Dim Dest As Range
>> Sheets("Sheet1").Select
>> Set RngColF = Range("F1", Range("F" & Rows.Count).End(xlUp))
>> With Sheets("Sheet2")
>> Set Dest = .Range("A1")
>> End With
>> For Each i In RngColF
>> If i.Value < 61 Then
>> i.EntireRow.Copy Dest
>> Set Dest = Dest.Offset(1)
>> End If
>> Next i
>> End Sub
>> "Office_Novice" <(E-Mail Removed)> wrote in message
>> news:F8836CCF-C225-4C66-8DC8-(E-Mail Removed)...
>> > Well Thats a good start thanks, if i could bother you for one more?
>> > Rather
>> > then spend the rest of my life typing this over and over
>> > Sub newone()
>> > If Range("F1").Value < 61 Then
>> > Sheets("Sheet1").Select
>> > Rows("1:1").Select
>> > Selection.Copy
>> > Sheets("Sheet2").Select
>> > ActiveSheet.Paste
>> > Sheets("Sheet1").Select
>> > End If
>> > If Range("F2").Value < 61 Then
>> > Rows("2:2").Select
>> > Selection.Copy
>> > Sheets("Sheet2").Select
>> > ActiveCell.Offset(1, 0).Select
>> > ActiveSheet.Paste
>> > Sheets("Sheet1").Select
>> > End If
>> > Could this be put in a loop to Do....Until There are no numbers < 61?
>> >
>> >
>> > "Otto Moehrbach" wrote:
>> >
>> >> Something like:
>> >> If Range("F5").Value<61 Then
>> >> 'Your code to move/copy whatever you want.
>> >> End If
>> >> You will probably need more than that if you want to "move" the entire
>> >> row
>> >> rather than just copy it.
>> >> HTH Otto
>> >> "Office_Novice" <(E-Mail Removed)> wrote in
>> >> message
>> >> news:22F93BF4-0D03-45A1-967E-(E-Mail Removed)...
>> >> > Is it possiable to Copy and paste if a specific condition exists?
>> >> >
>> >> > Heres the problem in column "F" there is a number. If that number is
>> >> > less
>> >> > then 61 i would like to move the entire row to another sheet. also
>> >> > the
>> >> > range
>> >> > will change with the data. can this be done?
>> >>
>> >>
>> >>

>>
>>
>>



 
Reply With Quote
 
Office_Novice
Guest
Posts: n/a
 
      24th Jan 2008
Isnt there always more? Thanks for you rhelp.

"Otto Moehrbach" wrote:

> So far so good?? You mean there's more? Otto
> "Office_Novice" <(E-Mail Removed)> wrote in message
> news:78FF6FA6-635F-4BC0-BA1A-(E-Mail Removed)...
> > So Far so Good thanks Otto!
> >
> > "Otto Moehrbach" wrote:
> >
> >> Maybe something like this: HTH Otto
> >> Sub newone()
> >> Dim RngColF As Range
> >> Dim i As Range
> >> Dim Dest As Range
> >> Sheets("Sheet1").Select
> >> Set RngColF = Range("F1", Range("F" & Rows.Count).End(xlUp))
> >> With Sheets("Sheet2")
> >> Set Dest = .Range("A1")
> >> End With
> >> For Each i In RngColF
> >> If i.Value < 61 Then
> >> i.EntireRow.Copy Dest
> >> Set Dest = Dest.Offset(1)
> >> End If
> >> Next i
> >> End Sub
> >> "Office_Novice" <(E-Mail Removed)> wrote in message
> >> news:F8836CCF-C225-4C66-8DC8-(E-Mail Removed)...
> >> > Well Thats a good start thanks, if i could bother you for one more?
> >> > Rather
> >> > then spend the rest of my life typing this over and over
> >> > Sub newone()
> >> > If Range("F1").Value < 61 Then
> >> > Sheets("Sheet1").Select
> >> > Rows("1:1").Select
> >> > Selection.Copy
> >> > Sheets("Sheet2").Select
> >> > ActiveSheet.Paste
> >> > Sheets("Sheet1").Select
> >> > End If
> >> > If Range("F2").Value < 61 Then
> >> > Rows("2:2").Select
> >> > Selection.Copy
> >> > Sheets("Sheet2").Select
> >> > ActiveCell.Offset(1, 0).Select
> >> > ActiveSheet.Paste
> >> > Sheets("Sheet1").Select
> >> > End If
> >> > Could this be put in a loop to Do....Until There are no numbers < 61?
> >> >
> >> >
> >> > "Otto Moehrbach" wrote:
> >> >
> >> >> Something like:
> >> >> If Range("F5").Value<61 Then
> >> >> 'Your code to move/copy whatever you want.
> >> >> End If
> >> >> You will probably need more than that if you want to "move" the entire
> >> >> row
> >> >> rather than just copy it.
> >> >> HTH Otto
> >> >> "Office_Novice" <(E-Mail Removed)> wrote in
> >> >> message
> >> >> news:22F93BF4-0D03-45A1-967E-(E-Mail Removed)...
> >> >> > Is it possiable to Copy and paste if a specific condition exists?
> >> >> >
> >> >> > Heres the problem in column "F" there is a number. If that number is
> >> >> > less
> >> >> > then 61 i would like to move the entire row to another sheet. also
> >> >> > the
> >> >> > range
> >> >> > will change with the data. can this be done?
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Block cell if specific condition exists WildWill Microsoft Excel Misc 7 15th Mar 2009 07:38 PM
How to Add columns if a condition exists swanley007 Microsoft Excel Misc 1 5th May 2008 11:11 AM
Condition If Table Exists... Brian via AccessMonster.com Microsoft Access Macros 5 2nd Apr 2005 09:42 PM
Requiring Input If A Condition Exists =?Utf-8?B?U0NX?= Microsoft Access Database Table Design 1 4th Jan 2005 06:15 PM
Table Exists Condition JoeCL Microsoft Access Queries 1 1st May 2004 12:52 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:21 AM.