Reporting Services export to Excel with Multiple Worksheets

后端 未结 8 1890
无人共我
无人共我 2020-11-27 02:56

I\'m currently building a MS Reporting Services Report that gets rendered to excel. I\'m trying to figure out how to set up the report so that it creates multiple Worksheets

8条回答
  •  囚心锁ツ
    2020-11-27 03:22

    Put the tab name on the page header or group TableRow1 in your report so that it will appear in the "A1" position on each Excel sheet. Then run this macro in your Excel workbook.

    Sub SelectSheet()
            For i = 1 To ThisWorkbook.Sheets.Count
            mysheet = "Sheet" & i
            On Error GoTo 10
            Sheets(mysheet).Select
            Set Target = Range("A1")
            If Target = "" Then Exit Sub
            On Error GoTo Badname
            ActiveSheet.Name = Left(Target, 31)
            GoTo 10
    Badname:
            MsgBox "Please revise the entry in A1." & Chr(13) _
            & "It appears to contain one or more " & Chr(13) _
            & "illegal characters." & Chr(13)
            Range("A1").Activate
    10
            Next i
    End Sub
    

提交回复
热议问题