List view column headers not appearing - despite view = lvwReport

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!


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
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

nachiketdp

Board Regular
Joined
Jan 31, 2007
Messages
53
I got the solution. I simply removed the list view lying on my user form and re-inserted a new one. Gave it the same name, Search_Result and voila! It started working! How silly! Anyways, thank you very much to all of you who spent some time wondering what may have gone when everything appeared in order..
 

Watch MrExcel Video

Forum statistics

Threads
1,133,575
Messages
5,659,616
Members
418,514
Latest member
radonwilson

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top