![]() |
Page Header: Setting using InputBox for LeftHeader
How can I set an InputBox default value to the active worksheet's LeftHeader?
More infor - if needed: ================ I have a workbook with several worksheets. Each sheet has the same page setup except for the LeftHeader. Instead of using FilePageSetup on every sheet I select each sheet then run a macro that uses an InputBox to prompt for the LeftHeader and reset it. This works OK except the InputBox value is initially <blank What I would really like to do is to set the InputBox default value to the existing LeftHeader value. This way I don't have to re-type the header in full when, for example, I only want to correct a spelling mistake. |
Page Header: Setting using InputBox for LeftHeader
InputBox "Get some information.", "Information",
ActiveSheet.PageSetup.LeftHeader Mark Ivey "GeraldM" wrote in message ... How can I set an InputBox default value to the active worksheet's LeftHeader? More infor - if needed: ================ I have a workbook with several worksheets. Each sheet has the same page setup except for the LeftHeader. Instead of using FilePageSetup on every sheet I select each sheet then run a macro that uses an InputBox to prompt for the LeftHeader and reset it. This works OK except the InputBox value is initially <blank What I would really like to do is to set the InputBox default value to the existing LeftHeader value. This way I don't have to re-type the header in full when, for example, I only want to correct a spelling mistake. |
Page Header: Setting using InputBox for LeftHeader
This should accommodate what you were wanting to do...
(mind the line returns from this post) getHeader = InputBox("The current left header is shown below. Change as needed.", "Left Header", ActiveSheet.PageSetup.LeftHeader) ActiveSheet.PageSetup.LeftHeader = getHeader Mark Ivey "Mark Ivey" wrote in message ... InputBox "Get some information.", "Information", ActiveSheet.PageSetup.LeftHeader Mark Ivey "GeraldM" wrote in message ... How can I set an InputBox default value to the active worksheet's LeftHeader? More infor - if needed: ================ I have a workbook with several worksheets. Each sheet has the same page setup except for the LeftHeader. Instead of using FilePageSetup on every sheet I select each sheet then run a macro that uses an InputBox to prompt for the LeftHeader and reset it. This works OK except the InputBox value is initially <blank What I would really like to do is to set the InputBox default value to the existing LeftHeader value. This way I don't have to re-type the header in full when, for example, I only want to correct a spelling mistake. |
Page Header: Setting using InputBox for LeftHeader
Thanks Mark.
"Mark Ivey" wrote: This should accommodate what you were wanting to do... (mind the line returns from this post) getHeader = InputBox("The current left header is shown below. Change as needed.", "Left Header", ActiveSheet.PageSetup.LeftHeader) ActiveSheet.PageSetup.LeftHeader = getHeader Mark Ivey "Mark Ivey" wrote in message ... InputBox "Get some information.", "Information", ActiveSheet.PageSetup.LeftHeader Mark Ivey "GeraldM" wrote in message ... How can I set an InputBox default value to the active worksheet's LeftHeader? More infor - if needed: ================ I have a workbook with several worksheets. Each sheet has the same page setup except for the LeftHeader. Instead of using FilePageSetup on every sheet I select each sheet then run a macro that uses an InputBox to prompt for the LeftHeader and reset it. This works OK except the InputBox value is initially <blank What I would really like to do is to set the InputBox default value to the existing LeftHeader value. This way I don't have to re-type the header in full when, for example, I only want to correct a spelling mistake. |
Page Header: Setting using InputBox for LeftHeader
Option Explicit
Sub testme() Dim myStr As String Dim myInput As String myStr = ActiveSheet.PageSetup.LeftHeader myInput = InputBox(prompt:="Verify the left header", _ Title:="Header", Default:=myStr) If Trim(myInput) = "" Then 'do nothing, don't clear the header Else ActiveSheet.PageSetup.LeftHeader = myInput End If End Sub I don't like Sendkeys, but this worked for me, too: Option Explicit Sub testme() Application.SendKeys "h%c" Application.Dialogs(xlDialogPageSetup).Show End Sub GeraldM wrote: How can I set an InputBox default value to the active worksheet's LeftHeader? More infor - if needed: ================ I have a workbook with several worksheets. Each sheet has the same page setup except for the LeftHeader. Instead of using FilePageSetup on every sheet I select each sheet then run a macro that uses an InputBox to prompt for the LeftHeader and reset it. This works OK except the InputBox value is initially <blank What I would really like to do is to set the InputBox default value to the existing LeftHeader value. This way I don't have to re-type the header in full when, for example, I only want to correct a spelling mistake. -- Dave Peterson |
All times are GMT +1. The time now is 03:00 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com