nachiketdp
Board Regular
- Joined
- Jan 31, 2007
- Messages
- 53
Dear All,
I created a listview (Search_Master) in one project. I copied it to another project. However, in that project, it is not showing the listview column headers. It is surprising because it's working fine in the earlier project. The only major difference between the two is that in the 1st project, the column headers are obtained from a sheet in the same workbook while in the 2nd project they are obtained from another workbook. Is there any restriction on using column headers from another workbook?
I am attaching the code herewith for your reference.
Any inputs will be highly appreciated!
Thanks in Advance!
I created a listview (Search_Master) in one project. I copied it to another project. However, in that project, it is not showing the listview column headers. It is surprising because it's working fine in the earlier project. The only major difference between the two is that in the 1st project, the column headers are obtained from a sheet in the same workbook while in the 2nd project they are obtained from another workbook. Is there any restriction on using column headers from another workbook?
I am attaching the code herewith for your reference.
Any inputs will be highly appreciated!
Thanks in Advance!
Code:
Private Sub Master_Cat_Change()
Application.ScreenUpdating = False
'to show all sheet
Application.Run "show_all"
If Master_Cat.Value = "Child Master" Then catcol = 10
If Master_Cat.Value = "Survey Master" Then catcol = 13
If Master_Cat.Value = "Anganwadi Master" Then catcol = 8
If Master_Cat.Value = "Beat Master" Then catcol = 9
If Master_Cat.Value = "ICDS Project Master" Then catcol = 12
If Master_Cat.Value = "Taluka Master" Then catcol = 14
If Master_Cat.Value = "District Master" Then catcol = 11
If Master_Cat.Value = "Project Master" Then catcol = 15
WS = Worksheets("Login").Cells(1, 1001)
main_path = "D:\Teaching\Excel\Clients\Annada\System\Database Files"
proj = Worksheets(WS).Cells(1, 12)
finpath = main_path & "\" & proj & "\"
fnam = finpath & Master_Cat.Value & ".xlsx"
Workbooks.Open Filename:=fnam, Password:="abcd", WriteResPassword:="1234"
dbook = ActiveWorkbook.Name
Worksheets(Master_Cat.Value).Select
Dim C As Long
Dim I As Long
Dim R As Long
ThisWorkbook.Activate
Me.Search_Result.View = lvwReport
Me.Search_Result.HideSelection = False
Me.Search_Result.FullRowSelect = True
Me.Search_Result.HotTracking = True
Me.Search_Result.HoverSelection = False
Me.Search_Result.ColumnHeaders.Clear
Me.Search_Result.ColumnHeaders.Add Text:="", Width:=2
For C = 1 To 16384
If Workbooks(dbook).Worksheets(Master_Cat.Value).Cells(1, C) = "" Then GoTo outsideC:
hedding = Workbooks(dbook).Worksheets(Master_Cat.Value).Cells(1, C).Text
Me.Search_Result.ColumnHeaders.Add , , hedding, 75
Next C
outsideC:
Workbooks(dbook).Close (False)
Workbooks.Open Filename:="D:\Teaching\Excel\Clients\Annada\System\Database Files\Supporting Masters.xlsx", Password:="abcd", WriteResPassword:="1234"
dbook = ActiveWorkbook.Name
Worksheets("Supporting Masters").Select
Me.Cat.Clear
For I = 2 To 1048576
If Cells(I, catcol) = "" Then Exit For
Me.Cat.AddItem Cells(I, catcol).Text 'material code
Next I
'to hide all sheet
Workbooks(dbook).Close (False)
ThisWorkbook.Activate
Application.Run "hide_all"
Application.ScreenUpdating = True
End Sub