Note: Excel 2003
Hi There (again),
I'm currently tearing my hair out trying to define ranges using variables rather than hard coding in the references
Dim TheCell As Range
Dim TheNextCellDown As Range
Dim ANCol As String
Dim StartofDataRow As Long
Dim i As Long
' These Values will probably change
StartofDataRow = 3
ANCol = "B"
With ActiveWorkbook.Sheets("All Data")
TheCell = Range(ANCol & (StartofDataRow + i)) 'eg "B3"
TheNextCellDown = Range(ANCol & (StartofDataRow + i + 1)) 'eg B4
Do Until IsEmpty(TheCell.Value)
If TheCell.Value = TheNextCellDown.Value Then
' Process the duplicate
etc...
I am aware that this is all do-able by selecting a cell, making is active then going and using the offset method but I am trying to rewrite this bit of code to be firstly more readable/debuggable and secondly faster if possible.
Please Tell me this is possible somehow.
Lea.
Hi There (again),
I'm currently tearing my hair out trying to define ranges using variables rather than hard coding in the references
Dim TheCell As Range
Dim TheNextCellDown As Range
Dim ANCol As String
Dim StartofDataRow As Long
Dim i As Long
' These Values will probably change
StartofDataRow = 3
ANCol = "B"
With ActiveWorkbook.Sheets("All Data")
TheCell = Range(ANCol & (StartofDataRow + i)) 'eg "B3"
TheNextCellDown = Range(ANCol & (StartofDataRow + i + 1)) 'eg B4
Do Until IsEmpty(TheCell.Value)
If TheCell.Value = TheNextCellDown.Value Then
' Process the duplicate
etc...
I am aware that this is all do-able by selecting a cell, making is active then going and using the offset method but I am trying to rewrite this bit of code to be firstly more readable/debuggable and secondly faster if possible.
Please Tell me this is possible somehow.
Lea.