+ Reply to Thread
Results 1 to 5 of 5

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

  1. #1
    Registered User
    Join Date
    03-12-2017
    Location
    morocco
    MS-Off Ver
    excel 2016
    Posts
    3

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

    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 link for exemple in attachements.



    thx for help and time.
    Attached Files Attached Files
    Last edited by zouhair akkour; 03-12-2017 at 07:25 PM.

  2. #2
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

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

    Interesting workbook and I am sure it makes sense to you.
    However, I don't have a clue as to what you want. Maybe an explanation will help.

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,598

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

    (How to) Upload a Workbook directly to the Forum
    (please do not post pictures or links to worksheets)
    • Click Advanced next to Quick Post button at the bottom right of the editor box.
    • Scroll down until you see "Manage Attachments",
    • Click the "Choose" button at the upper left (upload from your computer).
    • Select your file, click "open", click "upload"
    • Once the upload is completed the file name will appear below the input boxes in this window.
    • Close the Attachment Manager window.
    • Click "Submit Reply"
    Note: Please do not attach password protected workbooks/worksheets
    Ensure to disable any Workbook Open/Autorun macros before attaching!
    Ben Van Johnson

  4. #4
    Registered User
    Join Date
    03-12-2017
    Location
    morocco
    MS-Off Ver
    excel 2016
    Posts
    3

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

    thank you for your time .
    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 .

  5. #5
    Registered User
    Join Date
    03-12-2017
    Location
    morocco
    MS-Off Ver
    excel 2016
    Posts
    3

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

    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; 03-13-2017 at 11:44 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Help with Copying Ranges and Offsets
    By lfwake2wake in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-25-2013, 01:57 PM
  2. VBA Coding Help With Validation Macros in Excel 2010
    By Gavilan101 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-28-2013, 02:37 AM
  3. [SOLVED] checkboxes to run multiple ranges of macros
    By ShoshanaM in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-19-2012, 02:56 AM
  4. [SOLVED] How to create multiple Dynamic Named Ranges at once? and Limit in excel 2010
    By vishnu01445 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-31-2012, 09:28 AM
  5. Coding based on table data (multiple ranges)
    By gcoug in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-27-2011, 12:49 PM
  6. [SOLVED] dynamic offsets
    By lost in forum Excel General
    Replies: 3
    Last Post: 01-08-2006, 03:35 AM
  7. [SOLVED] Correct coding entry of VBA macros in Excel worksheet
    By Jack R in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-30-2005, 07:10 AM
  8. [SOLVED] cutting and pasting ranges using offsets
    By timmulla in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-14-2005, 02:05 PM

Tags for this Thread

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