Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Greater than, less than, cut and paste rows to sheet3

Hello
I am looking for a way to grab data in sheet1 column Y that is 0 or <0 (ie
any number that isnt 0). I then want to take those rows where data is
located, cut and paste them into Sheet3, starting at B23.
Does anyone know a good way of doing this? Thank you
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Greater than, less than, cut and paste rows to sheet3

Autofilter on not equal to 0

F5Special to select visible rows.

Copy and paste to Sheet3 at B23

Go back to source sheet which still has visible cells selected and
DeleteEntire Row.


Gord Dibben MS Excel MVP




On Thu, 1 Oct 2009 08:00:02 -0700, Withnails
wrote:

Hello
I am looking for a way to grab data in sheet1 column Y that is 0 or <0 (ie
any number that isnt 0). I then want to take those rows where data is
located, cut and paste them into Sheet3, starting at B23.
Does anyone know a good way of doing this? Thank you


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Greater than, less than, cut and paste rows to sheet3

I have done this very quickly before i leave office & may need some correction.
Hopefully will do what you want or give you some further ideas.

Sub CopyFilterData()
Dim rng As Range
Dim rng2 As Range
Dim ws1 As Worksheet

Set ws1 = Worksheets("Sheet1")

On Error GoTo exitprog
ws1.Range("Y1").AutoFilter _
field:=1, _
Criteria1:="<0", _
VisibleDropDown:=False

Set rng = ws1.AutoFilter.Range
Set rng = rng.Resize(rng.Rows.Count - 1)


Set rng2 = ws1.Range("Y1:Y" & rng.Count)


If Not rng2 Is Nothing Then
rng2.Copy Destination:=Sheets("Sheet3").Range("B23")
End If

rng.AutoFilter

exitprog:

On Error GoTo 0

End Sub
--
jb


"Withnails" wrote:

Hello
I am looking for a way to grab data in sheet1 column Y that is 0 or <0 (ie
any number that isnt 0). I then want to take those rows where data is
located, cut and paste them into Sheet3, starting at B23.
Does anyone know a good way of doing this? Thank you

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Greater than, less than, cut and paste rows to sheet3

thank you john, its nearly there, but doesnt copy the entire row? any clues?
thank you

"john" wrote:

I have done this very quickly before i leave office & may need some correction.
Hopefully will do what you want or give you some further ideas.

Sub CopyFilterData()
Dim rng As Range
Dim rng2 As Range
Dim ws1 As Worksheet

Set ws1 = Worksheets("Sheet1")

On Error GoTo exitprog
ws1.Range("Y1").AutoFilter _
field:=1, _
Criteria1:="<0", _
VisibleDropDown:=False

Set rng = ws1.AutoFilter.Range
Set rng = rng.Resize(rng.Rows.Count - 1)


Set rng2 = ws1.Range("Y1:Y" & rng.Count)


If Not rng2 Is Nothing Then
rng2.Copy Destination:=Sheets("Sheet3").Range("B23")
End If

rng.AutoFilter

exitprog:

On Error GoTo 0

End Sub
--
jb


"Withnails" wrote:

Hello
I am looking for a way to grab data in sheet1 column Y that is 0 or <0 (ie
any number that isnt 0). I then want to take those rows where data is
located, cut and paste them into Sheet3, starting at B23.
Does anyone know a good way of doing this? Thank you

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Greater than, less than, cut and paste rows to sheet3

sorry, did not pick that requirment up.

see if this helps:

Sub CopyFilterData()
Dim rng As Range
Dim rng2 As Range
Dim ws1 As Worksheet

Set ws1 = Worksheets("Sheet1")

On Error GoTo exitprog
ws1.Range("Y1").AutoFilter _
field:=1, _
Criteria1:="<0", _
VisibleDropDown:=False

Set rng = ws1.AutoFilter.Range
Set rng = rng.Offset(1).Resize(rng.Rows.Count - 1)


Set rng2 = rng.SpecialCells(xlCellTypeVisible)


If Not rng2 Is Nothing Then
rng2.Copy Destination:=Sheets("Sheet3").Range("B23")
End If

rng.AutoFilter

exitprog:

On Error GoTo 0

End Sub
--
jb


"Withnails" wrote:

thank you john, its nearly there, but doesnt copy the entire row? any clues?
thank you

"john" wrote:

I have done this very quickly before i leave office & may need some correction.
Hopefully will do what you want or give you some further ideas.

Sub CopyFilterData()
Dim rng As Range
Dim rng2 As Range
Dim ws1 As Worksheet

Set ws1 = Worksheets("Sheet1")

On Error GoTo exitprog
ws1.Range("Y1").AutoFilter _
field:=1, _
Criteria1:="<0", _
VisibleDropDown:=False

Set rng = ws1.AutoFilter.Range
Set rng = rng.Resize(rng.Rows.Count - 1)


Set rng2 = ws1.Range("Y1:Y" & rng.Count)


If Not rng2 Is Nothing Then
rng2.Copy Destination:=Sheets("Sheet3").Range("B23")
End If

rng.AutoFilter

exitprog:

On Error GoTo 0

End Sub
--
jb


"Withnails" wrote:

Hello
I am looking for a way to grab data in sheet1 column Y that is 0 or <0 (ie
any number that isnt 0). I then want to take those rows where data is
located, cut and paste them into Sheet3, starting at B23.
Does anyone know a good way of doing this? Thank you

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
Saving activesheet as csv in new workbook: I paste then save it butit saves it in sheet3 not Sheet1? Simon[_2_] Excel Programming 1 October 3rd 08 02:47 PM
Copy rows if greater than zero AndyB Excel Worksheet Functions 3 October 31st 07 02:52 AM
Delete Rows with Value greater than X STEVEB Excel Programming 4 July 26th 05 09:08 PM
Extract and copy Rows where value is Greater than 0 (zero) [email protected] Excel Programming 9 March 29th 05 02:03 PM
Auto-lookup values between Sheet3 & UserForm & paste to Sheet1 duBedat68 Excel Programming 2 December 22nd 04 01:37 PM


All times are GMT +1. The time now is 01:54 AM.

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"