LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Filter using Criteria


Hello,

Can anyone help me?

I use the command below, but still it didnt filter the rows with answer "N",
it copies all. Can I use Advanced Filter?

Please help

EXCEL INFO IS AS FOLLOWS:

A1:D4 --- MACRO BUTTON
A5:D17 --- HEADING (COMPANY NAME, ADDRESS, ETC)
A19:D20 -- FIELD NAME (Column A19 = LOCATION, Column B19 = ITEM, Column C19
= COMPLETED, C20 = Y/N, Column D19 = DEFECTS DESCRIPTION)
A21:D194 -- INFORMATION

ON THE REPORT, ONLY ROWS FROM A21:D194 WHERE COLUMN C:21:C194 = N WILL SHOW
or COPY ON THE REPORT.

ALSO, (1) IS THERE ANY WAY TO ADD IN OR INSERT PICTURES OR LOGO? (2) CHANGE
THE LETTERS, EG ON B2 "THIS IS THE CHECKLISTS" THEN CHANGE TO "THIS IS THE
REPORT" ?

DELETE rows not working. below is the command.


Sub GENREP()

Dim myC As Worksheet
Dim myS As Worksheet
Dim myR As Range
Dim wb As Workbook

Set myS = Worksheets("Finishes Checklists")

On Error Resume Next
Worksheets("Finishes Report").Delete

Set myC = Sheets.Add(Type:="Worksheet")
myC.Name = "Finishes Report"

Set myR = myS.Range("A5:E" & myS.Cells(Rows.Count, 5).End(xlUp))
myR.AutoFilter Field:=3, Criteria1:="N" ----- NOT WORKING
myS.Cells.SpecialCells(xlCellTypeVisible).Copy
myC.Range("A1").PasteSpecial xlPasteValues
myC.Range("A1").PasteSpecial xlPasteFormats
myC.Range("A1").PasteSpecial xlPasteColumnWidths
myS.ShowAllData

Intersect(myC.Range("5:" & Rows.Count), myC.Columns(3)).Delete
Shift:=xlToLeft
myC.Range("A1:C4").Delete Shift:=xlShiftToLeft ------- NOT WORKING
myC.Move

Columns("A:A").ColumnWidth = 32
Columns("B:B").ColumnWidth = 26
Columns("C:C").ColumnWidth = 98

With myC.PageSetup ------- NOT WORKING
..LeftMargin = Application.InchesToPoints(0.1)
..RightMargin = Application.InchesToPoints(0.1)
..TopMargin = Application.InchesToPoints(0.1)
..BottomMargin = Application.InchesToPoints(0.1)
..HeaderMargin = Application.InchesToPoints(0.1)
..FooterMargin = Application.InchesToPoints(0.1)
End With

ActiveWorkbook.SaveAs Application.GetSaveAsFilename _
("Finishes Report.xls")
End Sub

I have this macro command and its working fine, o
 
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
Filter with criteria! ernietan Excel Discussion (Misc queries) 1 April 15th 10 09:40 AM
Filter under and above certain criteria Geo Excel Discussion (Misc queries) 2 October 24th 07 05:29 PM
Filter criteria Tony Excel Discussion (Misc queries) 2 November 24th 05 10:40 AM
"Criteria Range" in the "Data/Filter/Advanced Filter" to select Du TC Excel Worksheet Functions 1 May 12th 05 02:06 AM
Filter Criteria desmondleow[_7_] Excel Programming 1 December 16th 03 01:10 PM


All times are GMT +1. The time now is 09:35 AM.

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"