Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88868

Excel VBA Start and Stop Underlining within a footer with a Variable

$
0
0

I would like to have a footer in the Rightfooter that has a string of text with a variable in it, no issues there but what I am finding some difficulty on is the syntax to begin underlining and terminate underlining at a specific point in the footer string. Basically, I need the work "Page" then 2 spaces that are underlined, then my page number which is generated by a variable also underlined, then 5 more spaces underlined thereafter, finally I need 10 more spaces not underlined in order to orient the footer to the correct position in the report that I am duplicating. Here is the code that I am attempting.

DIM pg as integer, WS as worksheet

pg = 14

With WS.PageSetup
    .RightFooter = "&Time New Roman""&12"& "Page""&U,  "& pg & """&U           "
End With

For this the first "&U, is getting an "Expected End Statment error. There is gobs of code in this thing that have been QC'd and this is the last QC element that is hanging me up, any assistance would be greatly appreciated.


Viewing all articles
Browse latest Browse all 88868


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>