View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
PaulM PaulM is offline
external usenet poster
 
Posts: 1
Default Combine 2 columns in a dynamic range into one

Hi -

I have a dynamic list in a worksheet of Forename (A2) and Surname (B2). This list changes every quarter so is not a set length (i.e. the number of rows will change)

I need to run a macro that will combine the first name and surname of all entries in this list into another location (E1).

I have been using a simple worksheet function (=A2&" "&B2), but am encountering issues with other functions returning errors when there are formulas in cells I need to treat as blank cells - so I think a macro is the way forwards.

I have recorded a macro that works for the active cell but am struggling to apply this to the entire list:

ActiveCell.FormulaR1C1 = _
"='SquadLists Import'!RC[-8]&"" ""&'SquadLists Import'!RC[-7]"
Range("E3").Select

I would also need to get the macro to delete any previous list creation in E1 before it pastes the new list in (in the event that there are fewer names in a new quarter).

Appreciate any help on this, VBA is very much a language I am learning!!