![]() |
adding to a VBA COde
Hi
The below code I am running works ok but I need to add an other part to it as this one: If Left(s, 1) = "1" Then i = 183 iloc = InStr(i, s, " ", vbTextCompare) t = 202 tloc = InStr(t, s, " ", vbTextCompare) s1 = Left(s, i - 1) s3 = Right(s, Len(s) - iloc) s2 = "*************** " Cell.Value = s1 & s2 & s3 But I am not too sure how to do it.... could you please help? Sub AABB() For Each Cell In Range("A1:A65000") s = Cell.Value If Left(s, 1) = "1" Then i = 208 iloc = InStr(i, s, " ", vbTextCompare) t = 223 tloc = InStr(t, s, " ", vbTextCompare) s1 = Left(s, i - 1) s3 = Right(s, Len(s) - iloc) s2 = "*************** " Cell.Value = s1 & s2 & s3 ElseIf Left(s, 1) = "2" Then i = 61 iloc = InStr(i, s, " ", vbTextCompare) t = 76 tloc = InStr(t, s, " ", vbTextCompare) s1 = Left(s, i - 1) s3 = Right(s, Len(s) - tloc) s2 = "*************** " Cell.Value = s1 & s2 & s3 Else End If Next Cells.Select Selection.Replace What:="""", Replacement:="", LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False |
All times are GMT +1. The time now is 09:42 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com