Results 1 to 13 of 13

For Loop with Condition on the Pattern of a Cell

Threaded View

  1. #1
    Registered User
    Join Date
    07-19-2013
    Location
    Paris
    MS-Off Ver
    Excel 2010
    Posts
    9

    For Loop with Condition on the Pattern of a Cell

    Hi all,

    New to Macros and VBA.
    I want to run a loop macro down a column (column 6) and check if the cell is hashed out (pattern 2) or not.
    If it is hashed, I want it to enter "-" in the adjacent cell to the right (column 7) and if it isn't I want to copy the text from the unhashed cell (column 6) to the adjacent cell to the right (column 7).

    Thanks in advance for any and all help.

    George

    Sub PrepareLCPTableforExport()
        Dim EndRow      As Integer
        Dim StartRow    As Integer
        Dim i           As Integer
         
        StartRow = 240
        EndRow = 329
        For i = StartRow To EndRow
            If Cells(i, 6).Pattern = 2 Then
            Cells(i, 7) = "-"
            Else
                Cells(i, 7) = Cells(i, 6)
            End If    
        Next i
    End Sub
    Last edited by georgesj; 07-23-2013 at 03:04 AM. Reason: Solved

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Can you change the order/pattern that vba uses to loop through a range?
    By Leon V (AW) in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 06-14-2013, 04:40 AM
  2. [SOLVED] Loop to change a cell until a condition is met
    By stephen11 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-22-2012, 07:34 AM
  3. condition format same value pattern become red
    By choy96 in forum Excel General
    Replies: 1
    Last Post: 11-28-2010, 05:51 AM
  4. Replies: 2
    Last Post: 07-27-2009, 09:29 AM

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