+ Reply to Thread
Results 1 to 7 of 7

Looping using left function resulting in Concatenate

Hybrid View

  1. #1
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Looping using left function resulting in Concatenate

    You Could try this
    Sub FindNum()
        Dim LastRow As String
        Dim Cell As Range
            
        LastRow = Range("K" & Rows.Count).End(xlUp).Row
        For Each Cell In ActiveSheet.Range("K6:K" & LastRow)
            If Left(Cell, 3) = "EGL" Then
                Cell = Cell & "&" & Cell.Offset(0, 1)
            End If
        Next
    
    End Sub
    Without some data to work with it isn't clear what you expecting as a result

    Hope this helps

    Remember the Code Tags in Post #1
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  2. #2
    Registered User
    Join Date
    04-20-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    26

    Re: Looping using left function resulting in Concatenate

    Quote Originally Posted by Marcol View Post
    You Could try this
    Sub FindNum()
        Dim LastRow As String
        Dim Cell As Range
            
        LastRow = Range("K" & Rows.Count).End(xlUp).Row
        For Each Cell In ActiveSheet.Range("K6:K" & LastRow)
            If Left(Cell, 3) = "EGL" Then
                Cell = Cell & "&" & Cell.Offset(0, 1)
            End If
        Next
    
    End Sub
    Without some data to work with it isn't clear what you expecting as a result

    Hope this helps

    Remember the Code Tags in Post #1
    Thanks a lot for your help on the above, But becuase i didnt explain myself very well this isnt what i was looking for. So for example i have a column that looks like this

    DGL2279378
    BR2 Rev
    DGL2279321
    DGL2279327

    I need the code to go down that column and concatenate all the ones that begin with DGL - so would have an output as follows

    (i need the output in a cell say cell 1 column 1) output = DGL2279378 & DGL2279321 & DGL2279327


    Thanks a lot for any help

    Jaimie
    Last edited by jaimie1664; 07-12-2010 at 04:27 AM.

+ 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