Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Adding the Title to the Column Header

Hi Gurus,

Using VBA I added the following code and I could see the title showing only once in the report. but when I try second time, I could not get the same result. Please help me with:

1) How to save the code? do I have to click any button after 'End Sub?

2)If I just close the editor and refresh the query, how the VBA code is activated?

3) Is the header title is going to stay for that query?

4) Pl. give the complete steps

Sub Test()

Sheets("Query").Select

Range("C28").Select

ActiveCell.FormulaR1C1 = "Product Name"

Range("A1").Select

End Sub

Former Member replied

Hi,You have to save the Query Result as Workbook first.

Then go to visual basic editor ( Tools (from excel) > Macro>Visual basic Editor).

You will see your Excel workbook number in the lefthand side of the Window.Expand it by clicking +

it is something like VBAProject(xSAPTemp35363.xls).

under modules you will find 'SAPBEX'. paste the below Code in that module (as it is)

Sub SAPBEXonRefresh(queryID As String, resultArea As Range)

Sheets("Query").Select

Range("C28").Select

ActiveCell.FormulaR1C1 = "Product Name"

Range("A1").Select

End Sub

Save the Workbook.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question