two word last names

  • Thread starter Thread starter David Bateman
  • Start date Start date
D

David Bateman

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
 
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?
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top