+ Reply to Thread
Results 1 to 2 of 2

Margins control to VBA code

Hybrid View

  1. #1
    Registered User
    Join Date
    06-27-2005
    Posts
    33

    Margins control to VBA code

    I need some help. The code below populates the header and footer information from cells on what I named the header page.

    I need this code to also adjust the top margin to 1.44" on the sheet when the header is updated.

    Thanks in advance!


    Sub SetHeader(sh As Worksheet)
    Dim lStr As String
    Dim rStr As String
    Dim dStr As String

    With Worksheets("HeaderPage")

    lStr = .Range("J2") & vbCr & .Range("J3") & vbCr & .Range("J4")
    rStr = .Range("M2") & vbCr & .Range("M3") & vbCr & .Range("M4") & vbCr & .Range("M5") & vbCr & .Range("M6")
    dStr = "&6" & Range("W1") & vbCr & .Range("W2") & vbCr & .Range("W3") & vbCr & .Range("W4")
    End With

    With sh.PageSetup
    .LeftHeader = lStr
    .RightHeader = rStr
    .CenterFooter = dStr


    End With
    End Sub

  2. #2
    tiah
    Guest

    Re: Margins control to VBA code

    record a new macro
    set your margin to 1.44
    go take a look at the code
    copy the line

    voil=E0 !


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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