Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
two word last names
I am importing data delimited, with tab and space selected if counta = 12
then everything is fine if counta = 13 then I have people with two word last names. When this is the case how would I programmatically combine the names in columns c, d to reflect this? Thank you in advance. db |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
two word last names
If I am understanding you, I think you can do this with a formula
If C1 = Abdul and D1 = Jabar in cell E1, enter =C1&"-"&D1 E1's value will be "Abdul-Jabar" Then just copy and paste as values. (The "-" is to hyphenate the name.) Does this help? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
two word last names
Hi David,
If I am guessing correctly you want to combine Column B & C together if there is a value in Column M (col 13), and then delete the cell in Column C in such rows shifting the remaining cells left. Suggest you try this on a copy of your worksheet. Sub Combine_BandC_if_M_notempty() 'David McRitchie, 2005-03-08 programming 'assumes since this came from elsewhere that Column M ' is either empty or has a constant (not a formula) ' an empty string i.e. single quote would not be empty Dim cell As Range, rng As Range, i As Long On Error Resume Next Set rng = Range("M:M").SpecialCells(xlConstants) If rng Is Nothing Then Exit Sub On Error GoTo 0 For Each cell In rng Cells(cell.row, 2) = ActiveSheet.Cells(cell.row, 2) _ & " " & Cells(cell.row, 3) Cells(cell.row, 3).Delete Shift:=xlToLeft Next cell End Sub --- HTH, David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001] My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm Search Page: http://www.mvps.org/dmcritchie/excel/search.htm "David Bateman" wrote in message ... I am importing data delimited, with tab and space selected if counta = 12 then everything is fine if counta = 13 then I have people with two word last names. When this is the case how would I programmatically combine the names in columns c, d to reflect this? Thank you in advance. db |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
converting email address names in a range of cells to real names | Excel Worksheet Functions | |||
Trying to merge from excel to word. New names won't merge | Excel Worksheet Functions | |||
How do I create a list (Word) of the names on Excel worksheet tabs | Excel Worksheet Functions | |||
Importing Microsoft Word File Names | Excel Worksheet Functions | |||
Change names of files in a folder to match names in Excel Column | Excel Programming |