automated macro's? and macro limitation to a worksheet

  • Thread starter Thread starter FAM THEUWS
  • Start date Start date
F

FAM THEUWS

1) Is there a way to automatically copy the content of a worksheet to a file
which has the name of that worksheet.
2) Is it possible to assign and limit a macro to a worksheet. I'm only
capable to attach a macro to a complete .xls file.
 
FAM

1) Is there a way to automatically copy the content of a worksheet to a file
which has the name of that worksheet.

Dim wb as Workbook
Dim sh as Worksheet

Set sh = ActiveSheet
Set wb = sh.Copy
wb.SaveAs sh.Name

Using Copy on a worksheet creates a new workbook with only that sheet. You
can then save the new workbook using the sheet's name.
2) Is it possible to assign and limit a macro to a worksheet. I'm only
capable to attach a macro to a complete .xls file.

Why? You can write a macro such that it only acts on a specific sheet or
can only be called by a specific sheet.
 
Back
Top