+ Reply to Thread
Results 1 to 20 of 20

deleting lines

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    06-23-2007
    Posts
    690
    thats of great help but of no real help noob
    although im grateful for your help i really dont understand formulas

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi stevesunfold,

    Just add the code to a module in your workbook then use this forumla in cell C2 and drag down

    =TEXT(A2,"dd/mm/yy")&" "&TEXT(B2,"HH:MM")

    module.

    Sub DeleteRows()
    Dim Last, Cnt As Long
    Dim Rng As Range
    Last = Cells(Rows.Count, "C").End(xlUp).Row
    Set Rng = Range("C2:C" & Last)
    For Cnt = Last To 1 Step -1
    If WorksheetFunction.CountIf(Rng, Cells(Cnt, "C").Value) > 1 Then
    Cells(Cnt, "C").EntireRow.Delete
    End If
    Next Cnt
    End Sub
    The code will run from the last cell in Col C to C2 deleting the entirerow as it goes.

    Non VBA would be use this in C2 and drag down

    =IF(MAX(COUNTIF(C2:C20,C2:C20))>1,"Duplicates","No Duplicates")
    Then filter on Duplicates and delete

    HTH

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Forum Contributor
    Join Date
    06-23-2007
    Posts
    690
    vba noob

    what can i say but youre a star

    many many thanks
    i did what you said and although i dont understand it it worked a treat

    thanks so much
    steve

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Glad it helped

    VBA Noob

  5. #5
    Forum Contributor
    Join Date
    06-23-2007
    Posts
    690
    it was more than a help it was fantstic i need to learn excel more but i just cant take it in like some.

    one more question please is there anyway i can extract info from one cell
    for example

    in cell b1 i have a time followed by a track

    ie

    2:20 lingfield is there anyway i can get the lingfield part of the cell into say column c?

    regards

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Maybe

    =TRIM(MID(B1,FIND(" ",B1),9999))

    VBA Noob

  7. #7
    Forum Contributor
    Join Date
    06-23-2007
    Posts
    690
    once again fantastic
    does exactly that but still leaves the time and the track in the first cell b1 where i did want it to be just the time

    gonna save then go have a play

    will let you know how i get on

    many many thanks
    if you are into horse racing let me know mate

+ 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