Announcement

Collapse
No announcement yet.

macro minor tweaking

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • macro minor tweaking



    I have this macro that does exatly what I ask but my parameters have changed. I have the macro search the document for 6160, 7160 then copy over to antoher sheet. Can I change the macro to search 616(then a wild card digit *) and do the same thing.

    Thanks

    Bill

    Code:
    Dim i As Long
        Dim j As Long
        Dim k As Long
         
        j = 1
        k = 1
        For i = 1 To 1000
             
            Select Case Range("e" & i).Value
            Case 6160, 7160 ' I would like it to search the 616* 
                Range("A" & i).EntireRow.Copy Sheets("616 716").Range("A" & j)
                j = j + 1
            Case 6180, 7180
                Range("A" & i).EntireRow.Copy Sheets("618 718").Range("A" & k)
                k = k + 1
            Case Else
                 'do nothing
            End Select
             
        Next i
    End Sub

  • #2
    Re: macro minor tweaking

    [ga]*[/ga] and edit your question with code tags please.
    Hope that Helps

    Roy

    New users should read the Forum Rules before posting

    For free Excel tools & articles visit my web site

    RoyUK's Web Site

    royUK's Database Form

    Where to paste code from the Forum

    About me.

    Comment


    • #3
      Re: macro minor tweaking

      billyj,

      A quick and dirty, but effective one if the codes are all numbers is to change the case statements:
      Code:
         Case 6160, 7160 
      
      becomes
      
          Case 6160 to 6169,7160 to 7169
      if the last character is not always a number then there is a need to change the code a bit more.

      HTH,

      Alan.

      Comment


      • #4


        Re: macro minor tweaking

        The quick and dirty works very well. Thanks

        Comment

        Working...
        X