Re: Conditional splitting of cells

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Tom Ogilvy (twogilvy_at_msn.com)
Date: 07/30/04


Date: Fri, 30 Jul 2004 09:50:05 -0400

varr = Array("mr","mrs","ms","dr")
for i = lbound(varr) to ubound(varr)
  iloc = instr(1,sCustomerName,varr(i),vbTextCompare)
  if iloc <> 0 then
     sTitle = varr(i)
     exit for
  end if
Next

Would be a start. You would also want to check that you found a title and
not a substring in the name (neDReck Smith for example)

-- 
Regards,
Tom Ogilvy
"Peter" <olsson_p@yahoo.com> wrote in message
news:239f3ee0.0407300520.4dcbef7c@posting.google.com...
> I've run into a problem and would be really grateful for any help.
>
> I bascially need to import data from a spreadsheet into our customer
> database but I need to split the 'customer name' field into three
> separate ones - Title (as applicable)/First Name/Last Name.
>
> The problem is that there is no consistency in how this data has been
> captured so some names contain their Title while others don't. I've
> already found a macro that allows me to split out the last name into a
> new column but I also need to identify Titles (hoping to being able to
> identify Mr/Mrs/Ms/Dr) where they appear and move them as well. Can
> anyone think of a macro that could do this?
>
> Thanks again,
> Peter


Relevant Pages

  • Re: Update automatically text from another
    ... Peter, thanks for the information. ... I did another question (about the footer) because I'd like to have a text ... It seems that the macro on exit from the text field properties is the right ... For Each objRange In ActiveDocument.StoryRanges ...
    (microsoft.public.word.mailmerge.fields)
  • Re: Combine INCLUDEPICTURE with variable?
    ... Running the macro neither. ... Dim pRange As Word.Range ... For Each pRange In ActiveDocument.StoryRanges ... 'Next line is added so customer logo will be updated ...
    (microsoft.public.word.vba.userforms)
  • Re: cant get each record to print separately
    ... Look at the information on fellow MVP Graham Mayor's website for which Peter gave you the link. ... your macro will save me from much physical therapy. ... bit hard to tell you exactly what commands to execute, ... written will send each of those letters to the printer as a separate print ...
    (microsoft.public.word.mailmerge.fields)
  • RE: Halt or Pause a Macro
    ... generated by our customer containing all of our jobs for the day each job has ... The first step of the Macro imports all of the ... information from the e-mail into the Master sheet and runs a text to columns ... At this point I need a break so if there are any tech number changes ...
    (microsoft.public.excel.programming)
  • Re: Vlookup displays wrong result
    ... If you do this on a regular scale you might want to install a macro ... | column A and the customer number in column B ... | If the customer being looked up was Dean it displays 234 when it should ...
    (microsoft.public.excel.worksheet.functions)