macro to save new file (same as tab name)

  • Thread starter Brian Thompson via OfficeKB.com
  • Start date
B

Brian Thompson via OfficeKB.com

Hi

I am recording macro and want to save the new macro- recorded sheet as the
same name as the sheet tab.
I do have the tab name in one of the cells A1, using =cell("filename",A1)
Example : sheet name week1, want to save new file as week1

I Can copy and paste into existing macro
thanks in advance

brian
 
B

Bob Phillips

Activeworkbook.SaveAs Filename:=Activesheet.Name

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)
 
B

Brian Thompson via OfficeKB.com

thanks, it worked, however, I do reqiure to save the acutal sheet the i'm
viewing. In the example below i was in sheet3.


What code do I replace line 3 and 4 to save the actual sheet i'm viewing
before running the macro?

example of pary recorded macro
ActiveCell.FormulaR1C1 = "3"
Range("E11").Select
Sheets("Sheet3").Select
Sheets("Sheet3").Copy
Range("E14").Select
Sheets("Sheet3").Select
ActiveWorkbook.SaveAs Filename:= _



Bob said:
Activeworkbook.SaveAs Filename:=Activesheet.Name

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)
[quoted text clipped - 7 lines]
 
B

Bob Phillips

What exactly do you mean by save the sheet? Normally, one saves a workbook,.
a sheet is part, but not all , of a workbook.

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

Brian Thompson via OfficeKB.com said:
thanks, it worked, however, I do reqiure to save the acutal sheet the i'm
viewing. In the example below i was in sheet3.


What code do I replace line 3 and 4 to save the actual sheet i'm viewing
before running the macro?

example of pary recorded macro
ActiveCell.FormulaR1C1 = "3"
Range("E11").Select
Sheets("Sheet3").Select
Sheets("Sheet3").Copy
Range("E14").Select
Sheets("Sheet3").Select
ActiveWorkbook.SaveAs Filename:= _



Bob said:
Activeworkbook.SaveAs Filename:=Activesheet.Name

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)
[quoted text clipped - 7 lines]
 
B

Brian Thompson via OfficeKB.com

Hi Bob

Will save workbook in usual way. then will copy sheet, paste special, format
and then save as the tab name. This new sheet(wkbook) will then be sent via
mail.

The last line does work, however, only keeps saving "sheet3"

What do I replace "Sheet3" (see below) with to save selected sheet I am
veiwing at the time

Sheets("Sheet3").Select
Range("A1").Select
ActiveWorkbook.SaveAs Filename:=ActiveSheet.Name

thanks for your patience !

regards

Brian

Bob said:
What exactly do you mean by save the sheet? Normally, one saves a workbook,.
a sheet is part, but not all , of a workbook.

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)
thanks, it worked, however, I do reqiure to save the acutal sheet the i'm
viewing. In the example below i was in sheet3.
[quoted text clipped - 26 lines]
 

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