2つのワークブックがあります。それらを "Main"と "Aux"と呼ぼう。あるワークシートの値を使用して、別のワークシートの値をチェックし、セルに戻ります。
"メイン"で実行され、 "Aux"からのデータを使用する関数を書いています。
"メイン"には、1つのワークシート上の人のリストがあります。一人一人のために、グレード> = 3のスキルを持つワークブック「Aux」をチェックし、それらを連結し、ワークブック「Main」にセルを記入したいと思います。
これまでに書いたコードです。問題は範囲が "メイン"ワークブックを参照していることであり、必要なデータは "Aux"ワークブックにあります。スキルが識別される
「AUX」の本のとき列「」「技術」
- を持つ列Gは、一人一人の名前を保持します。誰かが私に何を把握助けることができ
Public Function Arroz(name As String) As String Dim rngFound As Range Dim strFirst As String Dim strID As String Dim strDay As String Dim skillsAs String Dim deb As String Dim deb2 As String strID = "Person number one" strDay = "Technical" skills= "" Set rngFound = Workbooks("Aux.xlsx").Sheets("Skills Mao").Columns("G").Find(strID, Cells(Rows.Count, "G"), xlValues, xlWhole) If Not rngFound Is Nothing Then strFirst = rngFound.Address Do deb = Cells(rngFound.Row, "A").Text deb2 = Cells(rngFound.Row, "M").Value MsgBox deb MsgBox deb2 If LCase(Cells(rngFound.Row, "A").Text) = LCase(strDay) And Cells(rngFound.Row, "M").Value >= 4 Then skills = skills & Cells(rngFound.Row, "D").Text & " ," End If Set rngFound = Columns("G").Find(strID, rngFound, xlValues, xlWhole) Loop While rngFound.Address <> strFirst End If strLast = rngFound.Address Set rngFound = Nothing Arroz = competencies Exit Function End Function
:「AUX」に
- 列Dは、DEBとDEB2がメッセージボックス
コードを使用してデバッグするために使用されている
このコードを実行するとどうなるか教えてください。エラーメッセージが表示されますか? 'rngFound'は何かを見つけたら何も返されませんか? – CodeJockey
このコードを実行すると、ウォーズキー "Aux"から期待していたときに、ワークシート "Main"から値を取得します – noitib