Results 1 to 3 of 3

Thread: Excel functions in VBA (basic question)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    VBAX Newbie
    Joined
    Nov 2015
    Posts
    2
    Location
    Hi,
    The reason I posted this ad hoc question (I know they aren't really popular) is that this is just a minor job and I probably won't use VBA in the future (then again... who knows!). I just tried to find a way to handle a lot of data in an efficient way.

    Thank you, Paul, for investing your time to help me and make my life easier!

    For everyone else reading this: A minor modification was necessary for the code to actually do what I want:

    Sub Subsegments()
        Dim i As Long
         
         
        For j = 1 To 20
            Dim x As Integer
            x = 1
        For i = 1 To 10
    
    
            If InStr(ActiveSheet.Cells(j, 1).Value, ActiveSheet.Cells(i, 2).Value) > 0 Then
                ActiveSheet.Cells(j, 2 + x).Value = ActiveSheet.Cells(i, 2).Value
                x = x + 1
            End If
        Next i
        Next j
    End Sub
    Last edited by 0d1; 11-04-2015 at 03:48 PM.

Posting Permissions

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