Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]() paulinoluciano wrote: Thank you Harlan Grove! In fact, this solve my first "problem" related to this kind of text manipulation. However, now I have to specify in such VBA code that the sequence could be cut after or before two or more letters simultaneously. Example: The sequence is IADASFDTYEREPWQNMSDFGHKEASADSASSASADRASERAS cut after K or R 0 lost: IADASFDTYER EPWQNMSDFGHK EASADSASSASADR SER AS 1 lost cut: IADASFDTYEREPWQNMSDFGHK EPWQNMSDFGHKEASADSASSASADR EASADSASSASADRSER SERAS ..... Harlan Grove wrote: Bob Phillips wrote... ... If nIndex = 1 Then Cells(i, "A").Value = Right(Cells(i, "A").Value, _ Len(Cells(i, "A").Value) - 1) Else Cells(i, "A").Value = Left(Cells(i, "A").Value, nIndex - 1) & _ Right(Cells(i, "A").Value, Len(Cells(i, "A").Value) - nIndex) End If ... Could simplify: Right(x, Len(x) - y) == Mid(x, y + 1) Then again, the whole If block could be replaced by Cells(i, "A").Value = _ Application.WorksheetFunction.Replace(Cells(i, "A").Value, nIndex, 1, "") |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Using Concatenate function to generate text in Text Box | Charts and Charting in Excel | |||
merged cells into one text cell, size varies dependant on text dat | Excel Discussion (Misc queries) | |||
Text shown up in other cells everytime a text is entered in 1 cell | Excel Discussion (Misc queries) | |||
SUMPRODUCT vs Text??? | Excel Worksheet Functions | |||
Read Text File into Excel Using VBA | Excel Discussion (Misc queries) |