kmjones
08-02-2005, 08:57 AM
Below is the code I am working with. The line " If Month(Cells(9, curcolumn).Value) = Month(Cells(9, columncompare).Value) Then" is giving me a run time 13 error (type mismatch)... Anyone have any ideas on how I can fix that? Thanks!
Sub datemerger()
Dim curcolumn, columncompare As Integer
curcolumn = 9
columncompare = curcolumn + 1
Do While (Len(Sheets("Part").Cells(9, curcolumn).Value) > 0)
If Month(Cells(9, curcolumn).Value) = Month(Cells(9, columncompare).Value) Then
Range(Cells(9, curcolumn), Cells(9, columncompare)).Merge
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
End With
'curcolumn = curcolumn + 1
Else
curcolumn = columncompare
End If
columncompare = columncompare + 1
Application.DisplayAlerts = False
Loop
Application.DisplayAlerts = True
End Sub
Sub datemerger()
Dim curcolumn, columncompare As Integer
curcolumn = 9
columncompare = curcolumn + 1
Do While (Len(Sheets("Part").Cells(9, curcolumn).Value) > 0)
If Month(Cells(9, curcolumn).Value) = Month(Cells(9, columncompare).Value) Then
Range(Cells(9, curcolumn), Cells(9, columncompare)).Merge
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
End With
'curcolumn = curcolumn + 1
Else
curcolumn = columncompare
End If
columncompare = columncompare + 1
Application.DisplayAlerts = False
Loop
Application.DisplayAlerts = True
End Sub