- Nov 9, 2002
I've been trying to prevent user entry error for column entry. The following works for every column but "C" and column "C" does exist. I don't get it. Thanks for any assistance. Dave
I pasted this code in a blank workbook and every column but "D" didn't exist?
Sub RealColumn() Dim Outputcolstr As String, Lbstr As Variant, Cnt As Integer, Cfind As Range Outputcolstr = "D,F,HU7,U" 'User enters via input box Lbstr = Split(Outputcolstr, ",") For Cnt = 0 To UBound(Lbstr) With Sheets("Sheet1") Set Cfind = .Columns.Find(What:=Lbstr(Cnt), After:=.Cells(1, 1), LookAt:=xlWhole, _ SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False) If Cfind Is Nothing Then MsgBox "Column: " & Lbstr(Cnt) & " doesn't exist!" 'Exit Sub End If End With Next Cnt End Sub