-
Seeking some assistance. I am not a programmer but I managed to save my PDF’s by a different file name through a loop function.
-
I have 2 tabs that work coherently with each other. My master tab contains the necessary Main info while by second tab named is meant to construct and act as the framework boundaries for a saved PDF.
-
I am trying to create a loop that will replace a specific value from a cell.
-
I have attached screen shots.
-
I’m wanting D76 & D77(Master Tab) to be saved in cell A26 (Second Tab) when a loop is constructed.
-
Master Tab
-
Second Tab
-
Code Written
-
Example $50,000 from Master Tab D76 saved in cell A26 Second Tab, followed by saving the file name 1320 Millington Ct then create a PDF
-
Next Loop
-
Example $70,000 from Master Tab D77 saved in cell A26 Second Tab, Followed by saving the File name 315 Hillcrest dr.
-
My File name loop works well, but need the loop to save specific values before the PDF is made.
-
Any assistance would be much appreciated Thank You.
Sub Save_Muiltiple_SubTo_as_pdf()
'Sheet 1 Master Tab'
Dim mt As Worksheet
Set mt = ThisWorkbook.Sheets("Master_Tab")
Dim row_count As Integer
Dim LOIFilePath As String
LOIFilePath = mt.Range("J2")
' Sheet 2 Values saved in specific cells'
Dim st As Worksheet
Set st = ThisWorkbook.Sheets("SubTo")
SubTo_CashOffer = st.Range("A26")
Dim pdf_range As Range
EndRow = st.Range("J2")
Set pdf_range = st.Range("A1:" & EndRow)
mt.Activate
row_count = WorksheetFunction.CountA(Range("A1", Range("A1").End(xlDown)))
col_count = WorksheetFunction.CountA(Range("A1", Range("A1").End(xlToRight)))
'Master Tab save pdf according to new property address'
For i = mt.Range("H25") To row_count
Filename = mt.Cells(i, 5).Text
'Save PDF according to specific cash offer for that property'
On Error Resume Next
SubTo_CashOffer = mt.Cells(i, 4).Text
'Then Save the PDF with associated values'
pdf_range.ExportAsFixedFormat xlTypePDF, LOIFilePath & Filename & ".pdf"
On Error GoTo 0
Next i
End Sub