Is anyone aware of how to trigger text to rollover to the next blank cell if it's set in vba. I have the following code which is setting the values correctly removing duplicate values. My preference would have been to merge the cells to show the extended value where possible however as the data is in a table I'm not able to do this.
Public Sub GANT_TidyRow(ByVal argRow As Range, argDateTableRange As Range)
Dim lclLastValue As String
Dim lclFirstCell As Boolean
Dim lclCurrCell As Range
Dim lclCellRange As Range
Set argRow = argRow.Worksheet.Cells(argRow.Cells(1, 1).Row, argDateTableRange.Cells(1, 1).Column)
Set argRow = argRow.Resize(1, argDateTableRange.Columns.Count)
lclFirstCell = True
For Each lclCurrCell In argRow
If lclCurrCell.Value = lclLastValue And Not lclFirstCell Then
lclCurrCell.Value = ""
Set lclCellRange = lclCellRange.Resize(1, lclCellRange.Columns.Count + 1)
Else
If Not lclFirstCell Then
Call GANT_SetBorders(lclCellRange.Borders, _
xlNone, _
xlSingle, vbBlack)
End If
Set lclCellRange = lclCurrCell
lclFirstCell = False
lclLastValue = lclCurrCell.Value
End If
Next lclCurrCell
End Sub
Here's a screenshot, the first 2 rows were updated in vba to have the following cell set to blank. The last row I manually updated in excel to clear out the value and then the previous cell 'rolls over' in to the next one. There may well be a more common and accurate term for this please let me know if so. I can't post images due to insufficient rep, but here's a screen shot I took. http://imgur.com/Ti8InmL