Results 1 to 2 of 2

Thread: Macro for moving the columns

  1. #1

    Macro for moving the columns

    Hello, I created a macro for the purpose of checking whether there are columns with specific string my spreadsheet and in case there are, the macro should copy those columns into columns I-M. The problem is that my macro copy only the first value found into the entire column. Is there any way I could make it work? Thanks.
    [COLOR=#333333]Sub Find()[/COLOR] 
    Dim rngFound As Range 
    With Worksheets(3).Range("h:xy") 
        Set rngFound = .Find(What:="Pos", LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False) 
        Columns("i").Value = rngFound.Value 
        Columns("j").Value = rngFound.Offset(0, 1).Value 
        Columns("k").Value = rngFound.Offset(0, 2).Value 
        Columns("l").Value = rngFound.Offset(0, 3).Value 
        Columns("m").Value = rngFound.Offset(0, 4).Value 
    End With [COLOR=#333333]End Sub[/COLOR][COLOR=#333333][/COLOR] 
    Formatting tags added by mark007

    Attached Files Attached Files
      To view attachments your post count must be 0 or greater. Your post count is 0 momentarily.

  2. #2

Posting Permissions

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