Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Predefined Cell Character Length | Excel Worksheet Functions | |||
deleting a cell based on character length? | Excel Programming | |||
assigning character length in a cell | Excel Discussion (Misc queries) | |||
How do I limit the character length of a cell when typing | Excel Programming | |||
length of character data | Excel Discussion (Misc queries) |