Thread: need macro help
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default 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

wrote in message
ups.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