Data draw issues

Randalf_the_Red - May 7, 2017 at 06:40 PM

We're trying to create a document that displays the amount of homework hours for students based on the totals found in separate excel documents in each students personal folder.

Current students are fine right now, we have that sorted... what we're having issues with is creating a new document for when a new course arrives.

The file paths will always be the same structure with the only variables being the session number and student names.

The query we have at the moment looks something like this

Sub trainee()
' trainee macro
' Macro recorder blah blah blah

Selection.Replace What:="@", Replacement:=Range("B32"), LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
Cells.Replace What:="Trainee1", Replacement:=Range("B33:D33"), LookAt:=xlPart _
, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
End Sub

With the '@' being our variable in the file path for the session number and the 'Trainee1' is a one up to a max of 15 students per session

The "Range" fields point to a table to enter in the session number and student names.

The issue is when it replaces the '@' with the session number entered into Cell B32, it tries to pull the data before the full file path has been updated with the Trainee's name as a replacement to the 'Trainee1' for that selection...

Is there a way to delay the data pull until the whole path has been updated?