Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Gan
How can I truncate text to the right of and including / in a cell. Woul dlike to do it through cod Thanks! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
aCtivecell.value = left(activecell.value,instr(1,activecell.value,"/")-1)
-- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "JAmes" wrote in message ... Hi Gang How can I truncate text to the right of and including / in a cell. Woul dlike to do it through code Thanks! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you mean you want to retain everything to the left of the "/" try:
Sub test() Dim pos&, rng As Range Set rng = Range("A1") pos& = InStr(1, rng.Value, "/") If pos& Then rng.Value = Left(rng.Value, pos& - 1) End Sub JAmes wrote: Hi Gang How can I truncate text to the right of and including / in a cell. Woul dlike to do it through code Thanks! |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I think InStrRev is XL2000
Sub test() Dim str As String str = "abcde/fghij/klmno/pqrst" str = Mid(str, InStrRev(str, "/")) End Sub -- Rob van Gelder - http://www.vangelder.co.nz/excel "JAmes" wrote in message ... Hi Gang How can I truncate text to the right of and including / in a cell. Woul dlike to do it through code Thanks! |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Can this be applied to a range or do I have to loop through the range
Thanks for the response! |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
No, you can set a value to a range, but for this you will need to loop
through each cell. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "James" wrote in message ... Can this be applied to a range or do I have to loop through the range? Thanks for the response! |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
you have to loop through the range -- Regards Frank Kabel Frankfurt, Germany "James" schrieb im Newsbeitrag ... Can this be applied to a range or do I have to loop through the range? Thanks for the response! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I truncate linked text? | Excel Worksheet Functions | |||
formula to truncate text characters | Excel Discussion (Misc queries) | |||
truncate text to first word | Excel Discussion (Misc queries) | |||
How do you truncate a text string? | Excel Worksheet Functions | |||
truncate text using VBA Excel | Excel Programming |