Hi I have below code thanks to Alphafrog, which works brilliant I need to insert a msg if some criteria is is not full filled.
Below is the working code and I need to insert this criteria.
Please have a look and see if you can help
Sincerely
Abjac
Creteria to be inserted in the code is
If .Cells(i, "A") = "758" And .Cells(i, "B") = "03" And .Cells(i, "P") = "" Then .
MsgBox "You need to insert the account name for country code 758 ledger 03"
Exit sub
Here is the code I would like to merge this criteria with.
Sub alphafrog()
Dim i As Long, j As Long, arrEQ As Variant, iCell As Range
'Number of Dots in cells E to Q
arrEQ = Array(5, 8, 12, 2, 6, 6, 1, 1, 3, 11, 42, 35, 6)
Sheets("Robot").Activate
With Sheets("Robot")
For i = 3 To .Cells(.Rows.Count, "A").End(xlUp).Row
If WorksheetFunction.CountBlank(.Range("A" & i & ":AQ" & i)) <> 43 Then
'32 dots in cell R
If .Cells(i, "A") <> "" And .Cells(i, "B") = "03" Then
With .Cells(i, "R")
.Value = .Value & String(Application.Max(32 - Len(.Value), 0), ".")
End With
End If
'Cells E:Q (number of dots defined in arrEQ)
For j = 0 To 12
With .Cells(i, "E").Offset(, j)
.Value = .Value & String(Application.Max(arrEQ(j) - Len(.Value), 0), ".")
End With
Next j
'3 dots in cells S:AQ
For Each iCell In .Range("S" & i & ":AQ" & i)
iCell = iCell & String(Application.Max(3 - Len(iCell), 0), ".")
Next iCell
End If
Next i
End With
End Sub
Bookmarks