Results 1 to 7 of 7

Working with Odd and Even rows in coding

Threaded View

  1. #1
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Waterbury, CT
    MS-Off Ver
    Office 365
    Posts
    1,175

    Working with Odd and Even rows in coding

    Hello everybody,
    The code below checks if the left cell, which is 11 cells to the left of the target cell, is duplicated anywhere in column L and then copies the value in the target cell to every cell on column W that the value of the cell that is 11 cells to the left is matching the value of the target's 11 cells to the left.
    The code is currently copying the valueinto every ODD row, i would like the code to copy the value into every EVEN row. How can i go about doing this?
    If (Target.Row > 4) And (Target.Count = 1) And (Target.Column = 23) And (Target.Row Mod 2 = 0) Then
    If Not Target.Offset(-1, -11) = "N/A" Then
         Application.EnableEvents = False
         Application.ScreenUpdating = False
         Application.Calculation = xlManual
    
         Dim mtx4(), CurrCell4, LeftCell4, i4 As Long
         'Matrix of columns L:W
         mtx4 = Intersect(ActiveSheet.UsedRange, ActiveSheet.Range("L:W")).Value
         'Value of current cell
         CurrCell4 = Target.Value
         'Value of the cell left of current cell
         LeftCell4 = Target.Offset(-1, -11).Value
         'Comparing and set if matched
         For i4 = 1 To UBound(mtx4, 1)
             If mtx4(i4, 1) = LeftCell4 Then mtx4(i4, 12) = CurrCell4
         Next i4
         
         'Write matrix back to range L:W
         Range("L1").Resize(UBound(mtx4, 1), UBound(mtx4, 2)).Value = mtx4
    
         Application.EnableEvents = True
         Application.ScreenUpdating = True
         Application.Calculation = xlCalculationAutomatic
    End If
    End If
    It would be absolutely amazing if this issue can get resolved!
    Last edited by kosherboy; 01-20-2015 at 03:31 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Transfer coding not working
    By superdonk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-04-2014, 10:16 AM
  2. coding previously working in Excel 2003 version not working in Excel 2010
    By petercalbra in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-11-2012, 10:51 AM
  3. [SOLVED] VBA coding only working in the first sheet. It is not working in all the sheets
    By srinivasan1965 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 09-16-2012, 02:04 PM
  4. Coding in VBA not working
    By paubears08 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-21-2012, 07:21 PM
  5. Deactivate coding not working??
    By tazmanian24 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-03-2009, 07:28 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