View Single Post
 
Old 05-28-2020, 03:31 AM
albyefield albyefield is offline Windows 10 Office 2016
Novice
 
Join Date: Jul 2012
Location: Exeter
Posts: 27
albyefield is on a distinguished road
Default perform multiple operations when condition fulfilled

Hi
I have a situation where a column is occupied by a 1 to 3 digit integer but may have or not have multiple characters "i" appended .I wish to return 2 more columns 1 with the no from the first column and the other a string showing the appended "i"s
I managed it using VBA as follows

Sub testerlatest()
Dim a As String
Dim b As String
Dim c As String
n = 2
Do While Cells(n, 1) <> ""
b = ""
c = "i"
a = Cells(n, 1)
i = Len(a)
Do While Right(a, 1) = "i"
i = i - 1
b = b & c
a = Left(a, i)
Loop
Cells(n, 3) = a
Cells(n, 2) = b
n = n + 1
Loop
End Sub

But have been trying to solve the problem without resorting to VBA my problem is that I can’t find a way of doing more than one operation when a condition is true, easy enough to test more than on condition but ---

Any ideas please
Albie
Reply With Quote