VBA Coding help.

dstepan

Board Regular
Joined
Apr 16, 2009
Messages
160
I have a workbook with multiple sheets. Excel 2016.
I basically feed data from sheets 1 and 2 into a worksheet called "Prelim Estimate" (a1:f45).
I have another worksheet (worksheet5) called "Summary Data Base" which pulls the information from the "Prelim Estimate" - see below.

I would like to be able to do the following using VBA code. I have a few macros but would like to combine into one large VBA code if possible.

1. Save workbook: to a specified path in the format of
C:\Documents\Prelim Estimates\(cell e7 = customer name = C. Scott Marple ) & (cell e5 = estimate # = 6442) & (cell e6 = estimate date = 05/17/17).


2. Save worksheet "Prelim Estimate": as a PDF in format of C\documents\Prelim Estimates\same as above. This worksheet is to attach to an email with multiple recipients.

3. And/or: save the "Prelim Estimate" as a PDF to attach to an email and/or Print the PDF.

4. Copy and paste as value: the last line on worksheet "Summary Data Base" and copy formulas to next available line to prepare for the next estimate.

5. Save workbook again. Clear (see below) in Sheet 1 and Sheet 2. Renumber cell E5 on "Prelim Estimate" to the next number on "Summary Data Base" sheet Column B next number. For example, my last estimate used 6441 (B5). The next number will be 6442 (C5).

6. I have a couple of Macros already (see below) but would like to do all this as one VBA code.

Sheet one 'Assemblies' fields to clear: Name is "Clear_Assemblies" refers to -=Assemblies!$B$3,Assemblies!$B$4,Assemblies!$B$5,Assemblies!$B$6,Assemblies!$A$15,Assemblies!$B$15,Assemblies!$D$15,Assemblies!$H$13:$M$29,Assemblies!$B$20,Assemblies!$A$38,Assemblies!$B$38,Assemblies!$D$38,Assemblies!$B$43,Assemblies!$H$36:$M$52,Assemblies!$A$62,Assemblies!$B$62,Assemblies!$D$62,Assemblies!$B$67,Assemblies!$H$60:$M$76
Sheet two 'Estimate Workup' fields to clear: Name is "Clear EstWU" refers to -
='Estimate Workup'!$B$10:$G$27
ABCDE
1DateEstimate NumberCustomer NameTotal AmountRep Inits
25/14/20176441Tom Jones56.35RR
35/17/20176442C. Scott Marple273.55ABC
Summary Data Base
Worksheet Formulas
CellFormula
A3=+'Prelim ESTIMATE'!$E$6
B3=b2+1
C3=+'Prelim ESTIMATE'!$B$10
D3=+'Prelim ESTIMATE'!$F$41
E3=+Rep
Workbook Defined Names
NameRefers To
Rep=Assemblies!$B$6
<colgroup><col width="161" style="width: 121pt;"> <col width="175" style="width: 131pt;"> <col width="109" style="width: 82pt;"> <col width="98" style="width: 74pt;"> <col width="84" style="width: 63pt;"> <col width="58" style="width: 44pt;"> <tbody> </tbody>


Sub PDF()
'
' PDF Macro
'
'
Sheets("ESTIMATE").Select
Range("A1:F45").Select
ChDir "C:\Macro Files"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Macro Files\Estimate -.pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
False
End Sub


Sub Print_Estimate()
'
' Print_Estimate Macro
'
'
ActiveWorkbook.Save
Sheets("ESTIMATE").Select
Range("A4:F45").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
IgnorePrintAreas:=False
End Sub
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

Forum statistics

Threads
1,215,742
Messages
6,126,602
Members
449,321
Latest member
syzer

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top