+ Reply to Thread
Results 1 to 2 of 2

Macro:Looping

  1. #1
    Registered User
    Join Date
    11-19-2006
    Posts
    26

    Macro:Looping

    I am looking for a macro that loops through a column of data as follows. The data begins in row 2 of column D and the range is 2 thru 200. If the cell's background is VBYellow, I would like to grab the corrsponding column of data, paste it into column C, call another procedure, and then move on to the next cell. Cell 2 corresponds with column F, cell 3 with column G, cell 4 with column H... etc. If the cell is not VBYellow, I would like to move on to the next cell.

    Example: loop checks to see if cell 2 is VBYellow. If yes, column F is grabbed and pasted into column C and another procedure is called (Call test). If cell 2is not VBYellow, it moves on to cell 3. If cell3 is VBYellow, column G is grabbed and pasted into column C and another procedure is called... all the way through cell 200.

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    I hope I understand what you are after correctly.

    when getting the data to move into column C As each row increases by 1 so does the column increase by 1
    eg
    row 2 = column D
    row 10 = column N
    row 30 = column AH
    row 200 = column GV

    If my undestanding is correct try this macro, else reply with more details

    For iCnt = 2 To 200 Step 1
    If Cells(iCnt, "d").Interior.ColorIndex = 6 Then
    Cells(iCnt, iCnt + 4).Cut
    Cells(iCnt, "C").Select
    ActiveSheet.Paste
    Call Test
    End If
    Next iCnt
    End Sub

+ 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