I need the revenue and cost per company to be added in B3:C7 when I specify the dates I want in F3 and F4.
Thanks for the help!
Thanks for the help!
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("H6")) Is Nothing Then
Select Case Range("H6")
Case "Level 200":
Range(Range("B2000").End(xlUp).Offset(1, 0), "A11").EntireRow.Delete shift:=xlUp
Sheets("Level 200").Visible = True
Sheets("Level 200").Select
ActiveSheet.Range(Range("B200").End(xlUp), "H2").Copy
Sheets("Sheet1").Select
Range("B12").PasteSpecial xlPasteValues
Sheets("Level 200").Visible = False
End Select
End If
End Sub
=IF($AT3>=300000,$BS3*60%,IF($AT3<=250000,$BS3*40%,$BS3*50%))
=IF($AT3>=300000,$BS3*60%,IF($AT3<=250000,$BS3*40%,$BS3*50%)) + 500 + 600
Sht.Range("BT" & i).Formula + 500 + 600
Option Explicit ' Force variable declaration
Public Const PDF_WILDCARD = "*.pdf"
Public Const JOIN_FILENAME = "MASTER BOM.pdf"
Public Sub CopyFile2()
ChDrive "y:"
ChDir ThisWorkbook.Path
MkDir ("..\Submittal Packaged\BOM PDF\")
Dim rng As Range
Const strNewDir As String = "..\Submittal Packaged\BOM PDF\"
For Each rng In Range("L9:L1042").SpecialCells(xlCellTypeVisible)
If CBool(rng.Hyperlinks.Count) Then
With rng.Hyperlinks(rng.Hyperlinks.Count)
If CBool(InStr(.Address, Chr(92))) Then
If Dir(strNewDir & Replace(.Address, Chr(92), vbNullString, InStrRev(.Address, Chr(92)))) = "" Then
FileCopy .Address, _
strNewDir & Replace(.Address, Chr(92), vbNullString, InStrRev(.Address, Chr(92)))
Else
FileCopy .Address, _
strNewDir & rng.Row & "-" & Replace(.Address, Chr(92), vbNullString, InStrRev(.Address, Chr(92)))
End If
Else
If Dir(strNewDir & .Address) = "" Then
FileCopy .Address, _
strNewDir & .Address
Else
FileCopy .Address, _
strNewDir & rng.Row & "-" & .Address
End If
End If
End With
End If
Next rng
Call mergepdf
End Sub
Sub mergepdf()
Dim AcroExchApp As Object, AcroExchPDDoc As Object, _
AcroExchInsertPDDoc As Object
Dim strFileName As String, strPath As String
Dim iNumberOfPagesToInsert As Integer, _
iLastPage As Integer
Set AcroExchApp = CreateObject("AcroExch.App")
Set AcroExchPDDoc = CreateObject("AcroExch.PDDoc")
' Set the directory / folder to use
strPath = "..\Submittal Packaged\BOM PDF\"
' Get the first pdf file in the directory
strFileName = Dir(strPath + PDF_WILDCARD, vbNormal)
' Open the first file in the directory
AcroExchPDDoc.Open strPath + strFileName
' Get the name of the next file in the directory [if any]
If strFileName <> "" Then
strFileName = Dir
' Start the loop.
Do While strFileName <> ""
' Get the total pages less one for the last page num [zerobased]
iLastPage = AcroExchPDDoc.GetNumPages - 1
Set AcroExchInsertPDDoc = CreateObject("AcroExch.PDDoc")
' Open the file to insert
AcroExchInsertPDDoc.Open strPath + strFileName
' Get the number of pages to insert
iNumberOfPagesToInsert = AcroExchInsertPDDoc.GetNumPages
' Insert the pages
AcroExchPDDoc.InsertPages iLastPage, AcroExchInsertPDDoc, 0, iNumberOfPagesToInsert, True
' Close the document
AcroExchInsertPDDoc.Close
' Get the name of the next file in the directory
strFileName = Dir
Loop
' Save the entire document as the JOIN_FILENAME using SaveFull
[0x0001 = &H1]
AcroExchPDDoc.Save &H1, strPath + JOIN_FILENAME
End If
' Close the PDDoc
AcroExchPDDoc.Close
' Close Acrobat Exchange
AcroExchApp.Exit
End Sub
Public Sub CountdownTimer()
Application.OnTime Now + TimeValue("00:00:01"), "CountdownTimer"
Sheet2.Calculate
Application.Caption = CStr(Sheet2.Range("P16").Value) & " days, " & CStr(Sheet2.Range("Q16").Value) & " hours, " & CStr(Sheet2.Range("R16").Value) & " minutes, " & CStr(Sheet2.Range("S16").Value) & " seconds"
DoEvents
End Sub
'Public Sub CountdownTimer()
'If Application.Caption = CStr(Sheet2.Range("S16").Value) > ("0") Then
'Application.OnTime Now + TimeValue("00:00:01"), "CountdownTimer"
'Sheet2.Calculate
'Application.Caption = CStr(Sheet2.Range("P16").Value) & " days, " & CStr(Sheet2.Range("Q16").Value) & " hours, " & CStr(Sheet2.Range("R16").Value) & " minutes, " & CStr(Sheet2.Range("S16").Value) & " seconds"
'DoEvents
'ElseIf Application.Caption = CStr(Sheet2.Range("S16").Value) = ("0") Then
'Application.OnTime Now + TimeValue("00:00:15"), "CountdownTimer"
'Sheet2.Calculate
'Application.Caption = CStr(Sheet2.Range("P16").Value) & " days, " & CStr(Sheet2.Range("Q16").Value) & " hours, " & CStr(Sheet2.Range("R16").Value) & " minutes, " & CStr(Sheet2.Range("S16").Value) & " seconds"
'DoEvents
'End If
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Not Intersect(Target, Application.Range(MrktrNameField)) _
Is Nothing Then
UpdatePivotFieldFromRange _
MrktrNameField, JobRep, IncomePivot
End If
End Sub
Public Sub UpdatePivotFieldFromRange(MrktrNameField As String, JobRep As String, _
PivotTableName As String)
Dim rng As Range
Set rng = Application.Range(MrktrNameField)
Dim pt As PivotTable
Dim Sheet As Worksheet
For Each Sheet In Application.ActiveWorkbook.Worksheets
On Error Resume Next
Set pt = Sheet.PivotTables(IncomePivot)
Next
If pt Is Nothing Then GoTo Ex
On Error GoTo Ex
pt.ManualUpdate = True
Application.EnableEvents = False
Application.ScreenUpdating = False
Dim Field As PivotField
Set Field = pt.PivotFields(JobRep)
Field.ClearAllFilters
Field.EnableItemSelection = False
SelectPivotItem Field, rng.Text
pt.RefreshTable
Ex:
pt.ManualUpdate = False
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
Public Sub SelectPivotItem(Field As PivotField, ItemName As String)
Dim Item As PivotItem
For Each Item In Field.PivotItems
Item.Visible = (Item.Caption = ItemName)
Next
End Sub
Range("E2").Select
Selection.AutoFilter
ActiveSheet.Range("$A$2:$J$6747").AutoFilter Field:=5, Criteria1:="<=" & myValue, Operator:= _
xlFilterValues
Range("D2").Select
Selection.AutoFilter
ActiveSheet.Range("$A$2:$J$6747").AutoFilter Field:=4, Criteria1:="33", Operator:= _
xlFilterValues
Range("F2").Select
Selection.AutoFilter
ActiveSheet.Range("$A$2:$J$6747").AutoFilter Field:=6, Criteria1:="<>" & "A99", Operator:= _
xlFilterValues
Range("G2").Select
Selection.AutoFilter
ActiveSheet.Range("$A$2:$J$6747").AutoFilter Field:=7, Criteria1:="0", Operator:= _
xlFilterValues
Range("H2").Select
Selection.AutoFilter
ActiveSheet.Range("$A$2:$J$6747").AutoFilter Field:=8, Criteria1:="0", Operator:= _
xlFilterValues