VBA/Macro: Removing titles
Solved/Closed
Related:
- VBA/Macro: Removing titles
- Vba case like - Guide
- Number to words in excel formula without vba - Guide
- How to open vba in excel mac - Guide
- Vba check if value is in array - Guide
- Vba color index - Guide
3 responses
venkat1926
Posts
1863
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
811
Dec 3, 2009 at 05:38 AM
Dec 3, 2009 at 05:38 AM
try this formula
this will work whatever be the tile in C2 Mr,Mrs or Miss etc. The logic is find the first blank(that is after the title) and use that position in the mid function.
type in C2
Mr john smith or Miss Gabriel smith
and see what happen in the formula cell
=MID(C2,SEARCH(" ",C2)+1,LEN(C2)-SEARCH(" ",C2)+1)
this will work whatever be the tile in C2 Mr,Mrs or Miss etc. The logic is find the first blank(that is after the title) and use that position in the mid function.
type in C2
Mr john smith or Miss Gabriel smith
and see what happen in the formula cell
venkat1926
Posts
1863
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
811
Dec 4, 2009 at 05:16 AM
Dec 4, 2009 at 05:16 AM
you include sheets name before with an exclamation mark.
suppose Mr john smith is in sheet 1 cell C2
then in any other sheet and in any empty copy this formula
experiment with this formula
suppose Mr john smith is in sheet 1 cell C2
then in any other sheet and in any empty copy this formula
=MID(Sheet1!C2,SEARCH(" ",Sheet1!C2)+1,LEN(Sheet1!C2)-SEARCH(" ",Sheet1!C2)+1)
experiment with this formula
Hi!
I got syntax error when I used it. Here's the entire code I'm working on:
Dim counter As Integer
Dim row As Integer
Dim strFormula As String
counter = 2
row = 2
Do Until IsEmpty(Sheets("ORG CHART").Range("A" & row))
If Sheets("ORG CHART").Range("E" & row) = "PERMANENT" Then
counter = counter + 1
Sheets("MASTER DATA").rows(counter).Columns("A").Value = Sheets("ORG CHART").rows(row).Columns("I").Value
Sheets("MASTER DATA").rows(counter).Columns("C").Value = Sheets("ORG CHART").rows(row).Columns("P").Value
Sheets("MASTER DATA").rows(counter).Columns("D").Value = Sheets("ORG CHART").rows(row).Columns("C").Value
Sheets("MASTER DATA").rows(counter).Columns("E").Value = Sheets("ORG CHART").rows(row).Columns("U").Value
Sheets("MASTER DATA").rows(counter).Columns("F").Value = Sheets("ORG CHART").rows(row).Columns("V").Value
Sheets("MASTER DATA").rows(counter).Columns("G").Value = Sheets("ORG CHART").rows(row).Columns("J").Value
strFormula = "=MID(Sheets("ORG CHART")!Range("K" & row),SEARCH(" ",Sheets("ORG CHART")!Range("K" & row)+1,LEN(Sheets("ORG CHART")!Range("K" & row))-SEARCH(" ",Sheets("ORG CHART")!Range("K" & row)+1)
Sheets("MASTER DATA").rows(counter).Columns("B").Value = strFormula
End If
row = row + 1
Loop
Help!
I got syntax error when I used it. Here's the entire code I'm working on:
Dim counter As Integer
Dim row As Integer
Dim strFormula As String
counter = 2
row = 2
Do Until IsEmpty(Sheets("ORG CHART").Range("A" & row))
If Sheets("ORG CHART").Range("E" & row) = "PERMANENT" Then
counter = counter + 1
Sheets("MASTER DATA").rows(counter).Columns("A").Value = Sheets("ORG CHART").rows(row).Columns("I").Value
Sheets("MASTER DATA").rows(counter).Columns("C").Value = Sheets("ORG CHART").rows(row).Columns("P").Value
Sheets("MASTER DATA").rows(counter).Columns("D").Value = Sheets("ORG CHART").rows(row).Columns("C").Value
Sheets("MASTER DATA").rows(counter).Columns("E").Value = Sheets("ORG CHART").rows(row).Columns("U").Value
Sheets("MASTER DATA").rows(counter).Columns("F").Value = Sheets("ORG CHART").rows(row).Columns("V").Value
Sheets("MASTER DATA").rows(counter).Columns("G").Value = Sheets("ORG CHART").rows(row).Columns("J").Value
strFormula = "=MID(Sheets("ORG CHART")!Range("K" & row),SEARCH(" ",Sheets("ORG CHART")!Range("K" & row)+1,LEN(Sheets("ORG CHART")!Range("K" & row))-SEARCH(" ",Sheets("ORG CHART")!Range("K" & row)+1)
Sheets("MASTER DATA").rows(counter).Columns("B").Value = strFormula
End If
row = row + 1
Loop
Help!
venkat1926
Posts
1863
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
811
Dec 9, 2009 at 05:09 AM
Dec 9, 2009 at 05:09 AM
I have given a formula not a vba macro. it is little complex to use a formula with variable in vba
send a small extract of your date and what you want to be doen . attach .xls file to my email address through the administrator if allowed.
send a small extract of your date and what you want to be doen . attach .xls file to my email address through the administrator if allowed.
Dec 3, 2009 at 08:50 PM
It works! Thank you. Another question though, what if I need the Jane Smith to show up on another sheet?
Austin