Data draw issues

Closed
Report
-
Hello,

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
'

;
Range("B2:AB2").Select
Selection.Replace What:="@", Replacement:=Range("B32"), LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Cells.Replace What:="Trainee1", Replacement:=Range("B33:D33"), LookAt:=xlPart _
, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=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?