Private Sub

K

Kanmi

Please can anybody help me check why this give Compile Error higlighting "
Private Sub CommandButton1_Click()" in yellow. the first line of the code.
please advice and appreciate your time. thanks


Private Sub CommandButton1_Click()
ask = MsgBox("Build safety report?", vbYesNo, BoxTitle)
If ask = 7 Then Exit Sub

Select Case Range("D21")
Case "DOWNSTRM":
Set TrainingSht = Sheets("Training_Progress_By_Employee")
Set PersonnelSht = Sheets("Personnel Roster")
Set LookupSht = Sheets("Lookup")

Case "OFC":
Set TrainingSht = Sheets("Training_Progress_By_Employee2")
Set PersonnelSht = Sheets("Personnel Roster2")
Set LookupSht = Sheets("Lookup2")

End Select

Sub BuildDetailReport(TrainingSht, PersonnelSht, LookupSht)
MsgBox "Done", , BoxTitle
End Select


End Sub
 
P

Patrick Molloy

read my response in the original thread. Please stay on the original
thread - it saves time wasting for others who may not realise we have been
down this route already

In the code below you have inserted a procedure before the end sub

so please change FROM this

TO THISBuildDetailReport ' add your 3 parameters
Sub BuildDetailReport(TrainingSht, PersonnelSht, LookupSht)



In summary
your original code was missing the END SUB for the first procedure, which we
indicated that you should add. In doing so, you omitted the call to the
procedure to build the report. We suggested you do that

in the code below you MUST HAVE an End Sub AFTER the END SELECT and BEFORE
the definition for teh sub BuildDetailReport
Also , you initially had a call to this as I tried to indicate
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top