Etv5002
New Member
- Joined
- Sep 15, 2011
- Messages
- 30
Hi I know pretty much nothing about VBA, I plan on learning by doing.
I currently need help with the first macro project I've been working on I feel the the bare essential is there but I would realy like be be able to present something stellar.
The Goal of the MACRO:
I would a Worksheet that 1 button on it to run this specific macro, and 2 cells that are used within the macro.
the Macro needs to start by allowing the user to select what excel file the macro needs to be executed on (this part I'm having trouble with).
and the execution need to take all of the worksheets in the file and save them as individual workbooks:
this part works well, but I would like the text of the file name to reference a cell then the sheet name then the second cell rather then type it into the code which is how it currently is.
end.
getting that accomplished would be Awesome
Also I would eventually like to have those NOW individual workbooks auto email themselves (each sheet to a different email address) based on the file name and a list of email addresses.
Any Help would be greatly appreciated,
Thankyou.
I currently need help with the first macro project I've been working on I feel the the bare essential is there but I would realy like be be able to present something stellar.
The Goal of the MACRO:
I would a Worksheet that 1 button on it to run this specific macro, and 2 cells that are used within the macro.
the Macro needs to start by allowing the user to select what excel file the macro needs to be executed on (this part I'm having trouble with).
and the execution need to take all of the worksheets in the file and save them as individual workbooks:
Code:
Sub PLExport2invWkbkCode()
Dim wsMain As Worksheet
Dim wsNew As Worksheet
Dim wsPrior As Worksheet
Dim NewBook As Workbook, OldBook As Workbook, sh As Worksheet
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Set OldBook = ThisWorkbook
For Each sh In OldBook.Worksheets
If sh.Visible = True Then
sh.Copy
ActiveWorkbook.SaveAs Filename:=OldBook.Path & "\" & sh.Name & " part of the file name goes here ", FileFormat:=xlWorkbookNormal
ActiveWorkbook.Close
End If
Next
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
this part works well, but I would like the text of the file name to reference a cell then the sheet name then the second cell rather then type it into the code which is how it currently is.
end.
getting that accomplished would be Awesome
Also I would eventually like to have those NOW individual workbooks auto email themselves (each sheet to a different email address) based on the file name and a list of email addresses.
Any Help would be greatly appreciated,
Thankyou.