Why doesn't my telephone number show in the bottom right footer with the following code?
This is a telephone number (###.###.####) but I've tried various formats. Everything else works.
How do I make this run automatically with any change in the worksheet? I currently have to run the macro for it to update.
Bonus Question: What does "_" mean at the end of the lines after the line break?
Thanks for helping...
Sub SetFooter()
' custom footer
Dim wb As Workbook
Dim wsProfile As Worksheet
Dim strCompany As String
Dim strAddress As String
Dim strCity As String
Dim strZip As String
Dim strContact As String
Dim strEmail As String
Dim strTel As String
Set wb = ThisWorkbook
Set wsProfile = wb.Sheets("Company Profile")
strCompany= wsProfile.Range("pCompany").Value
strAddress = wsProfile.Range("pAddress").Value
strCity = wsProfile.Range("pCity").Value
strZip = wsProfile.Range("pZip").Value
strContact = wsProfile.Range("pContact").Value
strEmail = wsProfile.Range("pContactEmail").Value
strTel = wsProfile.Range("pContactTel").Value
With wsProfile.PageSetup
.LeftFooter = _
"&8" & Space(10) & strCompany & Chr(10) & _
"&8" & Space(10) & strAddress & Chr(10) & _
"&8" & Space(10) & strCity & ", TX" & strZip
.CenterFooter = ""
.RightFooter = _
"&8" & strContact & Chr(10) & _
"&8" & strEmail & Chr(10) & _
"&8" & strTel
End With
End Sub
This is a telephone number (###.###.####) but I've tried various formats. Everything else works.
How do I make this run automatically with any change in the worksheet? I currently have to run the macro for it to update.
Bonus Question: What does "_" mean at the end of the lines after the line break?
Thanks for helping...
Sub SetFooter()
' custom footer
Dim wb As Workbook
Dim wsProfile As Worksheet
Dim strCompany As String
Dim strAddress As String
Dim strCity As String
Dim strZip As String
Dim strContact As String
Dim strEmail As String
Dim strTel As String
Set wb = ThisWorkbook
Set wsProfile = wb.Sheets("Company Profile")
strCompany= wsProfile.Range("pCompany").Value
strAddress = wsProfile.Range("pAddress").Value
strCity = wsProfile.Range("pCity").Value
strZip = wsProfile.Range("pZip").Value
strContact = wsProfile.Range("pContact").Value
strEmail = wsProfile.Range("pContactEmail").Value
strTel = wsProfile.Range("pContactTel").Value
With wsProfile.PageSetup
.LeftFooter = _
"&8" & Space(10) & strCompany & Chr(10) & _
"&8" & Space(10) & strAddress & Chr(10) & _
"&8" & Space(10) & strCity & ", TX" & strZip
.CenterFooter = ""
.RightFooter = _
"&8" & strContact & Chr(10) & _
"&8" & strEmail & Chr(10) & _
"&8" & strTel
End With
End Sub