I have two pieces of code. They are both subroutines. They have the exact same coding up to a certain point but the 2nd one is giving me a "type mismatch" error. I don't see why it's reacting differently to the EXACT same coding!!
I've highlighted the code that is EXACTLY the same.
I promise that I researched this question before posting. I couldn't find a similar problem.
Thank you,
CWMacNut
Graphics Engineer
Code:
Sub DeleteSeqCol[COLOR=#ff0000][B](HeaderCount%, HeaderNames As Variant)
Range("A1").Select
a = 1 ' ("A1")
For a = 1 To HeaderCount
If HeaderNames(a) = "[/B][/COLOR]seq" Then
Range(Selection, Selection.End(xlDown)).Select
Selection.Delete Shift:=xlToLeft
Selection.ColumnWidth = 7 ' .AutoFit
Exit For
End If
Next
End Sub
Sub SortToVersion[COLOR=#ff0000][B](HeaderCount%, HeaderNames As Variant)
Range("A1").Select
a = 1 ' ("A1")
For a = 1 To HeaderCount
If HeaderNames(a) = "[/B][/COLOR]sort" Then [COLOR=#008000][B]<-------- this line is getting a "Type Mismatch" error[/B][/COLOR]
Selection.Offset(0, a).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ColumnWidth = 7
Selection.ClearContents
Selection.Offset(0, 1).Select
Selection.Offset(0, -1).Select
ActiveCell.FormulaR1C1 = "version"
Exit For
End If
Next
End Sub
I've highlighted the code that is EXACTLY the same.
I promise that I researched this question before posting. I couldn't find a similar problem.
Thank you,
CWMacNut
Graphics Engineer