Forum Discussion

YannickDVTC's avatar
YannickDVTC
Copper Contributor
Aug 29, 2022
Solved

Data Validation Cell Length with error message

Hi,    I am currently creating a template for suppliers where they have to fill in product information.  In order to avoid receiving bad quality data, I would like to create a macro that the suppl...
  • OliverScheurich's avatar
    Aug 29, 2022

    YannickDVTC 

    Sub data()
    
    Dim i As Long
    Dim j As Long
    
    For i = 21 To 7100
    For j = 24 To 26
    
    If Len(Cells(i, j)) > 32 Then
    MsgBox ("Error in column:" & j & "row:" & i)
    Else
    End If
    
    Next j
    
    Next i
    
    End Sub

    You can try this code. In the attached file you can click the button in cell V2 to run the macro. If a cell is longer than 32 digits an error message shows the row and column number of that cell.

Resources