Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In the following example:
Responsibility: Name1 / Name2 / Name3 How would I extract out Name1 in a macro and put it an an adjacent cell? Thank you, Steven |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On 13 May, 23:27, Steven wrote:
In the following example: Responsibility: Name1 / Name2 / Name3 How would I extract out Name1 in a macro and put it an an adjacent cell? Thank you, Steven How about this Sub extract_first_name() ' where the cell A1 contains "name1/name2/name3" Dim sResponsibility As String Dim sFirstName As String sResponsibility = Cells(1, 1) sFirstName = Left(sResponsibility, InStr(1, sResponsibility, "/") - 1) Cells(1, 2) = sFirstName End Sub Or if you have a whole column of cells containing multiple names then .... Sub extract_first_name_colum() Dim sResponsibility As String Dim sFirstName As String Dim myRow As Integer myRow = 1 Do Until Cells(myRow, 1) = "" sResponsibility = Cells(myRow, 1) sFirstName = Left(sResponsibility, InStr(1, sResponsibility, "/") - 1) Cells(myRow, 2) = sFirstName myRow = myRow + 1 Loop End Sub Cath |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Without any other instruction from you, I'll simply assume that text is in
the ActiveCell. Put this code in your macro... With ActiveCell .Offset(0, 1).Value = Trim(Split(Split(.Value, ":")(1), "/")(0)) End With Rick "Steven" wrote in message ... In the following example: Responsibility: Name1 / Name2 / Name3 How would I extract out Name1 in a macro and put it an an adjacent cell? Thank you, Steven |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() That is very nice. Thank you. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Extracting dates from a String | Excel Worksheet Functions | |||
Extracting h:mm:ss from text string | Excel Worksheet Functions | |||
Extracting from string | Excel Programming | |||
Extracting string within a string | Excel Worksheet Functions | |||
Extracting a string | Excel Discussion (Misc queries) |