Dynamic offset and dynamic range with condition
Dynamic offset and dynamic range with condition
Dynamic offset and dynamic range with condition
Dynamic offset and dynamic range with condition
Dynamic offset and dynamic range with condition
Dynamic offset and dynamic range with condition Dynamic offset and dynamic range with condition Dynamic offset and dynamic range with condition Dynamic offset and dynamic range with condition Dynamic offset and dynamic range with condition Dynamic offset and dynamic range with condition Dynamic offset and dynamic range with condition Dynamic offset and dynamic range with condition
Dynamic offset and dynamic range with condition Dynamic offset and dynamic range with condition
Dynamic offset and dynamic range with condition
Go Back  Xtreme Visual Basic Talk > > > > Dynamic offset and dynamic range with condition


Reply
 
Thread Tools Display Modes
  #1  
Old 03-14-2017, 11:40 AM
zouhair akkour zouhair akkour is offline
Newcomer
 
Join Date: Mar 2017
Posts: 2
Default Dynamic offset and dynamic range with condition


hi, at first i apologize for my poor english.

i am new in the world of excel vba, so basicly i know nothing about vba .

in the attachments a file that explain with color and steps for what i try to do with vba.

i use this macro to find duplicate value from the lastrow to the first row.

Code:
ActiveSheet.UsedRange


  LastRow = StartCell.SpecialCells(xlCellTypeLastCell).Row
  lastcolumn = StartCell.SpecialCells(xlCellTypeLastCell).Column
   
    
    
    Dim rngData As Range, ACell As Range, Cell As Range
Dim I As Long, J As Long, n As Long
    
    Set rngData = Range(StartCell, sht.Cells(LastRow, lastcolumn))
    
    For I = LastRow To 1 Step -1
        For J = lastcolumn 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.Cut Destination:=Cell.Offset(0, 8)
                    ACell.ClearContents
                    
                   
                    n = n + 1
                End If
            Next Cell
        Next J
    Next I
in the file example , the green cells are "CELL" and the orange cell are "ACELL"

so basicly this macro keep offset duplicated value by 8 column ."cell"

what i want to do is the inverse , keep offset duplicated value by 8 column. "ACELL".
Reply With Quote
  #2  
Old 03-14-2017, 06:30 PM
zouhair akkour zouhair akkour is offline
Newcomer
 
Join Date: Mar 2017
Posts: 2
Default

the file as attachments.
Attached Files
File Type: zip exemple.zip (13.9 KB, 3 views)
Reply With Quote
Reply

Tags
cell, range, acell, lastrow, rngdata, lastcolumn, vba, offset, file, macro, set, step, duplicated, column, basicly, dynamic, dim, rngdata.cellsi, sht.cellslastrow, destination=cell.offset0, cells, green, orange, .cell, inverse


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Dynamic offset and dynamic range with condition
Dynamic offset and dynamic range with condition
Dynamic offset and dynamic range with condition Dynamic offset and dynamic range with condition
Dynamic offset and dynamic range with condition
Dynamic offset and dynamic range with condition
Dynamic offset and dynamic range with condition Dynamic offset and dynamic range with condition Dynamic offset and dynamic range with condition Dynamic offset and dynamic range with condition Dynamic offset and dynamic range with condition Dynamic offset and dynamic range with condition Dynamic offset and dynamic range with condition
Dynamic offset and dynamic range with condition
Dynamic offset and dynamic range with condition
 
Dynamic offset and dynamic range with condition
Dynamic offset and dynamic range with condition
 
-->