The Code below works great to attach files starting from Cell C6. What wanted is if possible is to modify the code below to attach 10 files per row starting at C6, then another 10 attachments starting at E6, another 10 starting at G6, another 10 from I6, another 10 starting at K6 and another 10 starting at M6.
The potential is that at the most I will have 60 files attached and or some cases like 31 or 18...etc.
See Code below:
Public Sub insertFile()
Set Rng = Range("C6") 'Name the cell in which you want to place the attachment
Rng.RowHeight = 35
On Error Resume Next
fpath = Application.GetOpenFilename("All Files,*.*", Title:="Select file", MultiSelect:=True)
For i = 1 To UBound(fpath)
Rng.ColumnWidth = 10
Set Rng = Rng.Offset(0, 1)
Public Function extractFileName(filePath)
For i = Len(filePath) To 1 Step -1
If Mid(filePath, i, 1) = "\" Then
extractFileName = Mid(filePath, i + 1, Len(filePath) - i + 1)