+ Reply to Thread
Results 1 to 3 of 3

Header userform auto completion issue

  1. #1
    Registered User
    Join Date
    06-03-2014
    Posts
    9

    Unhappy Header userform auto completion issue

    Hey all,
    I'll give you background and then the issue.
    I've created a userform that does 2 things. 1st it copies selected worksheets to a new workbook using if then statements with check boxes
    2nd it inputs the header and footer with relevant information that I input in the user form. (see figure 2 for a part of the user form).

    The Problem: the user form works great. The date and page numbers populate in the footer in the new worksheets. But the left and right header do not populate with the user form values as I coded (figure 2). So instead I used this code (figure 3) to resolve this for now, but its SLOW and clunky. Can you suggest something to make it pull from the original figure 2 code? Thanks!


    Figure 1
    Untitled.png

    Figure 2 (red is code that doesn't work as described and green works as desired)
    "Sub header()
    ' header Macro
    ActiveWindow.View = xlPageLayoutView
    With ActiveWorkbook.PageSetup
    .LeftHeader = UserForm1.MultiPage1.Pages("page1").Frame1.TextBox1.Value & Chr(10) & UserForm1.MultiPage1.Pages("page1").Frame1.TextBox2.Value
    .CenterHeader = ""
    .RightHeader = UserForm1.MultiPage1.Pages("page1").Frame1.TextBox3.Value & Chr(10) & UserForm1.MultiPage1.Pages("page1").Frame1.TextBox4.Value
    .LeftFooter = "&D"
    '.CenterFooter = ""
    .RightFooter = "Page &P of &N"
    .LeftMargin = Application.InchesToPoints(0.7)
    .RightMargin = Application.InchesToPoints(0.7)
    .TopMargin = Application.InchesToPoints(0.75)
    .BottomMargin = Application.InchesToPoints(0.75)
    .HeaderMargin = Application.InchesToPoints(0.3)
    .FooterMargin = Application.InchesToPoints(0.3)
    .Zoom = False
    .FitToPagesWide = 1
    .FitToPagesTall = 1
    '.PrintErrors = xlPrintErrorsDisplayed
    '.OddAndEvenPagesHeaderFooter = False
    '.DifferentFirstPageHeaderFooter = False
    '.ScaleWithDocHeaderFooter = True
    '.AlignMarginsHeaderFooter = True


    End With
    ActiveWindow.View = xlNormalView
    End Sub"

    Figure 3
    " Dim ws As Worksheet
    For Each ws In Worksheets

    wb.Activate

    ' Formating Header of each sheet in the newly created workbook

    Call header

    Next ws
    Worksheets(1).Activate"

  2. #2
    Registered User
    Join Date
    06-03-2014
    Posts
    9

    Re: Header userform auto completion issue

    Also, under the command button "OK" it simply is coded for calling the code of the worksheet creation. It does not call the header. The call worksheet creation calls the header...maybe that should be rearranged?

    Also, it appears now that the date and page numbers were not actually getting called. They just happened to be already formatted that way on the original sheets being copied. So it confused me...

    SO! nothing is being called until after the sheets have been created. How do i set the call header section before the workbook is created? If possible to reduce time.

  3. #3
    Registered User
    Join Date
    06-03-2014
    Posts
    9

    Re: Header userform auto completion issue

    bump bump

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Auto Completion of Master Sheet from multiple Pages.
    By harsh_sultania in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-24-2013, 05:44 AM
  2. Sorting issue with Header
    By pibb55 in forum Excel General
    Replies: 1
    Last Post: 07-12-2012, 04:05 PM
  3. Header Issue
    By F3tz3r in forum Word Formatting & General
    Replies: 1
    Last Post: 04-07-2010, 12:16 PM
  4. UserForm exiting prior to completion
    By Ford_Guy in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-13-2008, 02:45 PM
  5. [SOLVED] Header Rows and Sort Issue
    By MikeL. in forum Excel General
    Replies: 1
    Last Post: 03-27-2006, 07:25 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1