save as command in macro

E

exploringmacro

Hi. Can someone help me please. I have two things that some help.

1. I've created workbook with multiple sheets, i made changes to one of the
sheet and i want to save that worksheet into new excel file. I've created a
macro but its not working.

2. I've created workbook with multiple sheets, eg, Sheet2 and Sheet 3. I
have a checklist template on Sheet 2 (see below), and on Sheet3, I need to
get the value from SHEET2 where FINDINGS=N (please see below), on SHEET 3 I
need the valud of CODE, DESCRIPTION and REMARKS

EG. SHEET2 (CHECKLIST)

CODE DESCRIPTION FINDINGS REMARKS
W32 STAIN N
STAIN ON FLOOR
W33 WALL PAINT Y

W34 TIMBER N
TIMBER DOOR

EG. SHEET3 (REPORT)

CODE DESCRIPTION REMARKS
W32 STAIN STAIN IN FLOOR
W34 TIMBER TIMBER DOOR

Appreciate your help.

thanks
 
S

Stefi

1. Post the macro!
2.
Sub test()
Columns("C:C").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="N"
Selection.CurrentRegion.Select
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Copy Destination:=Worksheets("Munka2").Range("A1")
End Sub

Regards,
Stefi



„exploringmacro†ezt írta:
 
D

Dave Peterson

#1.

Option Explicit
Sub testme()
Dim wks As Worksheet

Set wks = ActiveSheet 'or worksheets("Somesheetnamehere")
wks.Copy 'to a new workbook

With ActiveSheet
'just overwrite the .xls file, don't give me a warning
Application.DisplayAlerts = False
.Parent.SaveAs _
Filename:="C:\" & Format(Now, "yyyymmdd_hhmmss") & ".xls", _
FileFormat:=xlworkbooknormal
Application.DisplayAlerts = True
.Parent.Close savechanges:=False
End With

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top