I need some help.
I have a worksheet like this:
AndIwanttolimitamountofcharactersandtype
InthesegmentcolumnIwanttolimititto6charactersifitislessthan6ormorethan6.Returnsthemsg"Character limit not reached"
In the date column I want to limit the date type to 8 characters if it is less than 8 or more than 8. Returns the msg "Character limit not reached"
And in column number I want to limit the type number to 4 characters, if it is less than 4 or more than 4. Returns the msg "Character limit not reached"
I started writing something, but I can not see where I'm going wrong. And honestly for a long time I do not write VBA code
I'm not sure how to select the column and put the macro.
'If there are no 4 numbers' If IntSize < > 4 Then MsgBox "Unreached character limit", vbCritical Application.EnableEvents = False Rng.ClearContents Application.EnableEvents = True If anyone can help, I already thank
Código está assim:
Sub LimitarCaractere()
Dim TRACKER As Workbook '<-- Tracker
Dim MARKET As Worksheet '<-- Aba
Dim i As Long '<-- Linha selecionada
Dim SEGM As String '<-- Segment
Dim FLT As Integer '<-- Flight
Dim Ddate As Date '<-- Date
Set TRACKER = ActiveWorkbook
Set MARKET = TRACKER.ActiveSheet
i = ActiveCell.Row
'Limita o número de cacteres na célula
If i > 6 Then
ActiveCell = Left(ActiveCell, 6)
MsgBox "Limite de caracteres Ultrapassado na Célula: " _
& ActiveCell
End If
End Sub
Thank you