+ Reply to Thread
Results 1 to 3 of 3

need macro help

Hybrid View

  1. #1
    yuvalbra@walla.co.il
    Guest

    need macro help

    I need a macro to do so:
    I have a table of data like this

    123 TT 34.12
    200 TT 45.25
    180 TT 39.50
    250 SV 41.00
    250 SV 55.00
    310 XR 12.88

    i need to cut every lines that belong to TT and place them at new
    worksheet(tab) that called TT

    next, i need to cut every lines that belong to SV and place them at new
    worksheet(tab) that called SV

    ect....

    comments : i dont know how math lines there

    thanks for your help


  2. #2
    Bob Phillips
    Guest

    Re: need macro help

    Sub Test()
    Dim sh As Worksheet
    Dim stemp As String
    Dim rng As Range
    Dim i As Long

    Set sh = ActiveSheet
    Do While Range("B1").Value <> ""
    stemp = Range("B1")
    Set rng = Rows(1)
    i = 2
    Do While Cells(i, "B") <> ""
    If Cells(i, "B").Value = stemp Then
    Set rng = Union(rng, Rows(i))
    End If
    i = i + 1
    Loop
    Worksheets.Add.Name = stemp
    rng.Copy Worksheets(stemp).Range("A1")
    rng.Delete
    sh.Activate
    Loop
    End Sub


    --
    HTH

    Bob Phillips

    <yuvalbra@walla.co.il> wrote in message
    news:1124886228.835075.45240@g43g2000cwa.googlegroups.com...
    > I need a macro to do so:
    > I have a table of data like this
    >
    > 123 TT 34.12
    > 200 TT 45.25
    > 180 TT 39.50
    > 250 SV 41.00
    > 250 SV 55.00
    > 310 XR 12.88
    >
    > i need to cut every lines that belong to TT and place them at new
    > worksheet(tab) that called TT
    >
    > next, i need to cut every lines that belong to SV and place them at new
    > worksheet(tab) that called SV
    >
    > ect....
    >
    > comments : i dont know how math lines there
    >
    > thanks for your help
    >




  3. #3
    Tom Ogilvy
    Guest

    Re: need macro help

    See Ron de Bruin's site. He has sample code for situations similar to this.

    http://www.rondebruin.nl/tips.htm

    more specifically probably a modification of one of these:

    http://www.rondebruin.nl/copy5.htm

    --
    Regards,
    Tom Ogilvy

    <yuvalbra@walla.co.il> wrote in message
    news:1124886228.835075.45240@g43g2000cwa.googlegroups.com...
    > I need a macro to do so:
    > I have a table of data like this
    >
    > 123 TT 34.12
    > 200 TT 45.25
    > 180 TT 39.50
    > 250 SV 41.00
    > 250 SV 55.00
    > 310 XR 12.88
    >
    > i need to cut every lines that belong to TT and place them at new
    > worksheet(tab) that called TT
    >
    > next, i need to cut every lines that belong to SV and place them at new
    > worksheet(tab) that called SV
    >
    > ect....
    >
    > comments : i dont know how math lines there
    >
    > thanks for your help
    >




+ 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