代码
Public Function GetsArr(Svalue As String)On Error Resume NextDim GArr, cRangSet w = GetSheet(infoSheetName)w.ActivateSet cell = w.Range(w.Cells(3, 2), w.Cells(w.Cells(w.Rows.Count, 2).End(xlUp).Row, 2))For Each xcell In cell If Svalue = xcell.Value Then Set cRang = w.Range(w.Cells(xcell.Row, 1), w.Cells(xcell.Row, w.Range("A2").End(xlToRight).Column)) ReDim GArr(1 To w.Range("A2").End(xlToRight).Column) GArr = Application.WorksheetFunction.Transpose(cRang) GetsArr = GArr Exit For End IfNext xcell Set w = Nothing Set cell = Nothing Set xell = NothingEnd Function