View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JP[_4_] JP[_4_] is offline
external usenet poster
 
Posts: 897
Default Moving Info from onw sheet to another

It might be due to poor wrapping from the ng posting. Remove the "Set
rng" statement and replace it with the one below.

Set rng = .Resize(.Rows.Count - 1, .Columns.Count). _
SpecialCells(xlCellTypeVisible)


--JP


On Jan 9, 1:31*pm, Mike wrote:
Ok Now I think I am getting it. But I I keep getting a compile error wher it
says
Set rng = .resize ( .Rows.count - 1, .colums.count) any help there?



"JP" wrote:
Sorry I just realized you were asking for a new sheet, not a new
workbook. You could simply change "Set X = Workbooks.Add" to add a
sheet instead of a workbook, Dim X as Excel.Sheet instead, and change
the copy line to "rng.Copy X..Range("A1")" and it should still work.


HTH,
JP


On Jan 9, 12:04 pm, JP wrote:


Sub autofiltvisibleandcopytonewwkbk()


Dim rng As Excel.Range
Dim X As Excel.Workbook


Set rng = ActiveSheet.UsedRange.Rows


With rng
* * .AutoFilter Field:=6, Criteria1:="=13"
End With


With ActiveSheet.AutoFilter.Range
On Error Resume Next
* * Set rng = .Resize(.Rows.count -
1, .Columns.count).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
End With


Set X = Workbooks.Add


rng.Copy X.Sheets(1).Range("A1")


End Sub- Hide quoted text -


- Show quoted text -