E
exploringmacro
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:
A14 ---> MACRO BUTTON
A517 ---> HEADING (COMPANY NAME, ADDRESS, ETC)
A1920 --> FIELD NAME (Column A19 = LOCATION, Column B19 = ITEM, Column C19
= COMPLETED, C20 = Y/N, Column D19 = DEFECTS DESCRIPTION)
A21194 --> INFORMATION
ON THE REPORT, ONLY ROWS FROM A21194 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
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:
A14 ---> MACRO BUTTON
A517 ---> HEADING (COMPANY NAME, ADDRESS, ETC)
A1920 --> FIELD NAME (Column A19 = LOCATION, Column B19 = ITEM, Column C19
= COMPLETED, C20 = Y/N, Column D19 = DEFECTS DESCRIPTION)
A21194 --> INFORMATION
ON THE REPORT, ONLY ROWS FROM A21194 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