This is Probably an easy fix but i’m not seeing what mistake is.
I have 2 workbooks open right now. And I am wanting to Run my Macro saved my main workbook 1 onto workbook2, then pull and save necessary cells from workbook 2 onto workbook 1. This is what I have so far, and im getting a “Runtime Error 9 Subscript out of range”
Code
Sub Save_Muiltiple_SubTo_as_pdf()
'Lead Generation Workbook'
Set Source_workbook = Workbooks.Open("C:UsersdavidOneDriveDesktopReal EstateWhoop&DiscordLead Generation Personal Copy.xlsm")
Set LeadSource = Workbooks("Lead Generation Personal Copy").Sheets("List of Leads").Range("A1:Z500")
Dim row_count As Integer
'Master Tab Functions'
Dim mt As Worksheet
Set mt = ThisWorkbook.Sheets("Master_Tab")
Dim LOIFilePath As String
LOIFilePath = mt.Range("J2")
' SubTo 2 Main Functions'
Dim st As Worksheet
Set st = ThisWorkbook.Sheets("SubTo")
Dim pdf_range As Range
EndRow = st.Range("J2")
Set pdf_range = st.Range("A1:" & EndRow)
'SubTo Sheet Values that will get updated'
LeadSource.Activate
row_count = WorksheetFunction.CountA(Range("A1", Range("A1").End(xlDown)))
col_count = WorksheetFunction.CountA(Range("A1", Range("A1").End(xlToRight)))
For i = LeadSource.Range("I10") To row_count
If (LeadSource.Cells(i, 8).Text = "Subto") Then
Filename = LeadSource.Cells(i, 5).Text
'Save PDF according to specific cash offer for that property'
' SubTo_CashOffer = mt.Cells(i, 4).Text
st.Range("C18").Value = LeadSource.Cells(i, 9).Text ' ***
st.Range("A26").Value = LeadSource.Cells(i, 9).Text ' ***
st.Range("C37").Value = LeadSource.Cells(i, 9).Text ' ***
st.Range("A1").Value = LeadSource.Cells(i, 4).Text ' ***
End If
'Then Save the PDF with associated values'
On Error Resume Next
pdf_range.ExportAsFixedFormat xlTypePDF, LOIFilePath & Filename & ".pdf"
On Error GoTo 0
Next i
End Sub
I looked through the forums to check similar scenarios, and checked my filename spelling.