hi,
As Shg says, you're more likely to get useful answers when some context is provided in the form of a sample workbook with sample data & expected outcomes. Here's a rough attempt without this context:
Sub EgOfCaseStatements()
Dim cll As Range
Dim DesiredLength As Long
For Each cll In Selection
With cll
Select Case .Column
Case 3
DesiredLength = 4
Case 4
DesiredLength = 7
Case Else
DesiredLength = Len(.Value)
End Select
'(needs tweaking) _
.Value = .Value & Application.WorksheetFunction.Rept(".", DesiredLength & -Len(.Value))
'seems to work
.Value = .Value & Application.Evaluate("=REPT("".""," & DesiredLength & -Len(.Value) & ")")
End With
Next cll
End Sub
hth
Rob
Bookmarks