macro for excel
macro for excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: macro for excel

  1. #1
    New Member
    Join Date
    Mar 2002
    Posts
    14
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    I would like to write a macro that would sort a column, then insert a page break when the text changes within the sorted column. Your help is greatly appreciated!!

  2. #2
    Board Regular
    Join Date
    Mar 2002
    Location
    NY
    Posts
    1,041
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Best way to learn is to record your steps.
    On 2002-03-28 13:25, thor10 wrote:
    I would like to write a macro that would sort a column, then insert a page break when the text changes within the sorted column. Your help is greatly appreciated!!

  3. #3

    Join Date
    Mar 2002
    Posts
    15
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Sub Sort_InsertPageBreaks()
    Dim rng As Range, cell As Range
    Set rng = Range([A1], [A65536].End(xlUp))
    rng.Sort Key1:=rng(1, 1)
    For Each cell In rng
    If cell.Value <> cell(2, 1).Value Then
    cell(2, 1).EntireRow.PageBreak = xlManual
    End If
    Next
    End Sub

  4. #4
    Board Regular
    Join Date
    Feb 2002
    Posts
    3,169
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I dont understand the above post and how that answers your request, but the comment is true..

    How ever try this.. add a command button from the forms tool bar and right click it and assign macro and then click record..

    now do as you wish sortthe data, be careful mistakes are also recorded.. dont worry about the page braek bit..

    DONE

    Now select cell A1, and press the tool bar taht floating about the square stop...

    Select by right clicking the command button and assign macro BUT edit this time the VBE will open... read it...

    That the program you just wrote / recorded..

    Theres a start for you, if im telling you what you know sorry but your profile is first post, so except sorry just tring to get you started.
    Free Excel based Web Toolbar available here.

    Jack in the UK
    J & R Excel Solutions
    "making Excel work for you"

  5. #5
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    Hi

    You could try the Subtotals feature under Data. This allows for page breaks at each change.

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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

 

 
DMCA.com