R
Ron
Hello All,
Trying to validate 6 characters in column N. This one used to work
but for some reason it's failing. Has a inputbox for user to make
correction with. I need to apply this to other columns with different
length requirements. All assistance greatly appreciated. Thanks, Ron
Sub ValdateData()
'validate values in a column
Range("N11").Select
Range(Selection, Selection.End(xlDown)).Select
Set Rng = Selection
FirstRow = Rng.Row
LastRow = Rng.Rows(Rng.Rows.Count).Row
Col = "n"
'loop thru col n of database, but skip first row with headings
For i = FirstRow To LastRow
If Len(Range("a1")(i, Col).Value) <> 6 Then
FixColumnB
End If
Next i
End Sub
Sub FixColumnB()
'Enter a new value in Column B
Range("a1")(i, Col).Select
123456
Range("a1")(i, Col) = InputBox("Enter a 6 digit value")
'check to ensure six digits entered
If Len(Range("a1")(i, Col).Value) <> 6 Then
FixColumnB
End If
End Sub
Trying to validate 6 characters in column N. This one used to work
but for some reason it's failing. Has a inputbox for user to make
correction with. I need to apply this to other columns with different
length requirements. All assistance greatly appreciated. Thanks, Ron
Sub ValdateData()
'validate values in a column
Range("N11").Select
Range(Selection, Selection.End(xlDown)).Select
Set Rng = Selection
FirstRow = Rng.Row
LastRow = Rng.Rows(Rng.Rows.Count).Row
Col = "n"
'loop thru col n of database, but skip first row with headings
For i = FirstRow To LastRow
If Len(Range("a1")(i, Col).Value) <> 6 Then
FixColumnB
End If
Next i
End Sub
Sub FixColumnB()
'Enter a new value in Column B
Range("a1")(i, Col).Select
123456
Range("a1")(i, Col) = InputBox("Enter a 6 digit value")
'check to ensure six digits entered
If Len(Range("a1")(i, Col).Value) <> 6 Then
FixColumnB
End If
End Sub