Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB script to apply drill down functionality in excel

Status
Not open for further replies.

codesearcher

Technical User
Feb 23, 2009
7
US
Hi All,
I have a requirement, For the given excel sheet i have to apply drill down functionality and deliver as output. Along with filter and freezing pane. Am now ready with freezing pane and filter's can i get help to implement drill option in excel through vbscript?

Code used:
Sub Test()
Set objExcel = CreateObject("Excel.Application")

Set objWorkbook = objExcel.Workbooks.Open("D:\Test\Distributor.xlsx")

objExcel.Application.Visible = True

objExcel.ActiveWorkbook.Sheets("Sheet1").Range("12:12").Select
objExcel.ActiveWindow.FreezePanes = True

objExcel.ActiveWorkbook.Sheets("Sheet1").Activate
objExcel.ActiveWorkbook.Sheets("Sheet1").Cells(1, 1) = "H111i"

objExcel.ActiveWorkbook.Sheets("Sheet1").AutoFilterMode = False
objExcel.ActiveWorkbook.Sheets("Sheet1").Range("A1:B1").AutoFilter

'This is to create a new group - Row Level.
objExcel.ActiveWorkbook.Sheets("Sheet1").Range("1:1").EntireRow.Group
'objExcel.ActiveWorkbook.Sheets("Sheet1").Range("4:6").EntireRow.Group
'This is to create a new group - Column Level.
'objExcel.ActiveWorkbook.Sheets("Sheet1").Range("B:B").EntireColumn.Group
'objExcel.ActiveWorkbook.Sheets("Sheet1").Range("C:D").EntireColumn.Group

'This is to show the details on particular levels.
'objExcel.ActiveWorkbook.Sheets("Sheet1").Outline.ShowLevels RowLevels:=2

objExcel.ActiveWorkbook.Save
'objExcel.ActiveWorkbook.Close
'objExcel.Application.Quit
End Sub
 
 http://files.engineering.com/getfile.aspx?folder=308e927d-9a65-49d8-ad70-8519c06a8a32&file=visual.jpg
What language do you use in your code? If VBScript, then you can't use named arguments there (RowLevels:=2). If vba, there is a dedicated forum: forum707

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top