

TypeText Text:="List for " & SelectedName WrdRange.Collapse Direction:=wdCollapseEnd ' Insert text "List for (SelectedName) centered and underlined as the first line of the new word doc. Headers(wdHeaderFooterPrimary).Range.Text = vbTab & vbTab & "New Annex"

Note: A reference to the Word object library is required to run this macro If (ActiveSheet.Cells(i, 2) = SelectedName) Or (ActiveSheet.Cells(i, 3) = SelectedName) Or (ActiveSheet.Cells(i, 4) = SelectedName) Or (ActiveSheet.Cells(i, 5) = SelectedName) ThenĬolumnB2E_Array(k) = ActiveSheet.Cells(i, 6).Value If ActiveSheet.Cells(i, 1) = SelectedName ThenĬolumnA_Array(j) = ActiveSheet.Cells(i, 6).Value LastDataRow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row SelectedName = ActiveSheet.Range("G1").Value Set wrdRange = wrdDoc.Range 'creates a variable to track position in the word doc if needed Set wrdApp = CreateObject("Word.Application") ' and one list for each instance of the name in columns B-E

' one list for each instance of the name in Column A, ' This macro will create 2 lists of Column F items for a selected individual,
#LOOK NOTION EXCEL CODE#
PS: would appreciate if you could indicate in the code how I can choose the type of bullet as well as space between bullets and font type The document will have two sections:Ĥ) Insert text "Items in Column A" bolded and aligned to the leftĥ) Insert text "Items in Column B to E" bolded and aligned to the left below the section in 4Ħ) if "Stefan Thomas" is in column A, copy text in column F and paste in word doc as first bullet (below title "Items in Column A")ħ) repeat step 6 for all other instances of "Stefan Thomas" in column A (append text as next bullet in section "Items in Column A")Ĩ) If "Stefan Thomas" is in column B or C or D or E (can only appear once per row), copy text in column F and paste in word doc as first bullet (below title "Items in Column B to E")ĩ) repeat step 8 for all other instances of "Stefan Thomas" in column B or C or D or E (append text as next bullet in section "Items in Column B to E") "Stefan Thomas"):Ģ) Put "New Annex" as a header (top right) in the new word docģ) Insert text "List for Stefan Thomas" centered and underlined as the first line of the new word doc. I am looking for a vba code (Excel 2003) that would loop through cells in A1:E? (number of rows varies, loop needs to find last non-empty row in column A) and look for a particular name (e.g. A given name can only appear once in any given row. I have a simple excel sheet with columns A (name1) B (name2) C (name3) D (name4) E (name5) F (text).
