Results 1 to 4 of 4

Thread: Need help for coding in excel with VBA macros, multiple dynamic ranges and offsets

  1. #1

    Need help for coding in excel with VBA macros, multiple dynamic ranges and offsets

    Register for a FREE account, and/
    or Log in to avoid these ads!

    hi, first i want to apologize for my bad english.

    i Need help for coding a VBA macros with multiple dynamic ranges and offsets.

    Here is the file exemple in attachements.

    thx for help and time.
    Attached Files Attached Files

  2. #2
    i will do my best to explain what i want even if my english is bad.

    what i want is finding duplicate value then moving cells to another range.

    for exemple in T1 i have 2 duplicated value , 26 and 14 .
    i delete the value from row 2 and moving the value in row 3 from D3 and F3 to L3 and N3 in T2 then
    in T4 i have the value 26 as duplicate , so i delete the duplicated one in L3 and i move B6 to R6 in T5 .

  3. #3
    here's a simplified example with color for what i want to do with vba.

    i have the first and principal range with data , A to G (7 column), a second range from I to O (7 column) , third from Q to W (7 column)...

    i use this macro to find duplicate and cut destination .

    lastCol = rngData.Columns.Count
    lastRow = rngData.Rows.Count
    For I = lastRow To 1 Step -1
    For J = lastCol To 1 Step -1
    Set ACell = rngData.Cells(I, J)
    For Each Cell In rngData
    If Cell <> Empty And _
    Cell.Value = ACell.Value And _
    Cell.Address <> ACell.Address Then
    Cell.ClearContents "clear duplicated cells in the first row"
    Acell.cut destination:= Acell.offset(0,8)" move duplicated cells in the last row "
    n = n + 1
    End If
    Next Cell
    Next J
    Next I

    after that i have now two ranges with data , first range (A to G ) and second range from (I to O)."sheet T1"

    now in sheet T2 i have duplicated value.

    what i want is instead of Acell.cut destination:= Acell.offset(0,8) become Acell.cut destination:= Acell.offset(0,16) "sheet T3"

    only if the duplicated value are found in the second range and so on for the third range ...
    Acell.offset(0,8) become Acell.offset(0,16) become Acell.offset(0,32)...
    Attached Files Attached Files
    Last edited by zouhair akkour; 2017-03-13 at 04:45 PM.

  4. #4

Tags for this Thread

Posting Permissions

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