Add additional columns

I also want to add to each persons score going across the page the cells (see attached sheet and view code).
The sheet currently collates the scores from a number of worksheets in a folder.  I have added the cells I want to add to that Master going across the page.
Master.xls
Dier02Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GirardAndrewCommented:
Hi Dier02,

First of all, I have corrected your codes. I believe the Copy and Past Values function for columns 3 and 4 was not correct. Please refer to the code below for a fix.

Thanks,
Girard Andrew
Public Sub ListWorkbooks()
   Dim Directory As String
   Dim FileName As String
   Dim IndexSheet As Worksheet
   Dim rw As Long
   
   Directory = "" & Range("Path").Value & ""
   If Left(Directory, 1) <> "\" Then
       Directory = Directory & "\"
   End If
   
   rw = 10
   
   Set IndexSheet = ThisWorkbook.ActiveSheet
       
   FileName = Dir(Directory & "*")
   Do While FileName <> ""
       IndexSheet.Cells(rw, 2).Formula = "='" & Directory & "[" & FileName & "]" & Range("SheetName").Value & "'!A3"
       IndexSheet.Cells(rw, 2).Copy
       IndexSheet.Cells(rw, 2).PasteSpecial Paste:=xlPasteValues
       IndexSheet.Cells(rw, 3).Formula = "='" & Directory & "[" & FileName & "]" & Range("SheetName").Value & "'!C1"
       IndexSheet.Cells(rw, 3).Copy
       IndexSheet.Cells(rw, 3).PasteSpecial Paste:=xlPasteValues
       IndexSheet.Cells(rw, 4).Formula = "='" & Directory & "[" & FileName & "]" & Range("SheetName").Value & "'!C2"
       IndexSheet.Cells(rw, 4).Copy
       IndexSheet.Cells(rw, 4).PasteSpecial Paste:=xlPasteValues
       rw = rw + 1
       FileName = Dir
   Loop
   
   Set IndexSheet = Nothing
End Sub

Open in new window

0
GirardAndrewCommented:
Hi Dier02,

As for the additional columns, all you need to do is repeat the 3 line of codes and replace the column target and source cell. For the example below, I have added 2 columns for the target (columns 5 and 6) and used the data from cells C3 and C4 respectively.

I hope you will find this useful.

Sincerely,
Girard Andrew
Public Sub ListWorkbooks()
   Dim Directory As String
   Dim FileName As String
   Dim IndexSheet As Worksheet
   Dim rw As Long
   
   Directory = "" & Range("Path").Value & ""
   If Left(Directory, 1) <> "\" Then
       Directory = Directory & "\"
   End If
   
   rw = 10
   
   Set IndexSheet = ThisWorkbook.ActiveSheet
       
   FileName = Dir(Directory & "*")
   Do While FileName <> ""
   
       IndexSheet.Cells(rw, 2).Formula = "='" & Directory & "[" & FileName & "]" & Range("SheetName").Value & "'!A3"
       IndexSheet.Cells(rw, 2).Copy
       IndexSheet.Cells(rw, 2).PasteSpecial Paste:=xlPasteValues
       
       IndexSheet.Cells(rw, 3).Formula = "='" & Directory & "[" & FileName & "]" & Range("SheetName").Value & "'!C1"
       IndexSheet.Cells(rw, 3).Copy
       IndexSheet.Cells(rw, 3).PasteSpecial Paste:=xlPasteValues
       
       IndexSheet.Cells(rw, 4).Formula = "='" & Directory & "[" & FileName & "]" & Range("SheetName").Value & "'!C2"
       IndexSheet.Cells(rw, 4).Copy
       IndexSheet.Cells(rw, 4).PasteSpecial Paste:=xlPasteValues
       
       IndexSheet.Cells(rw, 5).Formula = "='" & Directory & "[" & FileName & "]" & Range("SheetName").Value & "'!C3"
       IndexSheet.Cells(rw, 5).Copy
       IndexSheet.Cells(rw, 5).PasteSpecial Paste:=xlPasteValues
       
       IndexSheet.Cells(rw, 6).Formula = "='" & Directory & "[" & FileName & "]" & Range("SheetName").Value & "'!C4"
       IndexSheet.Cells(rw, 6).Copy
       IndexSheet.Cells(rw, 6).PasteSpecial Paste:=xlPasteValues
       rw = rw + 1
       FileName = Dir
   Loop
   
   Set IndexSheet = Nothing
End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ingeborg Hawighorst (Microsoft MVP / EE MVE)Microsoft MVP ExcelCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.