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
 

Some videos you may like

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

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..
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,264
Messages
5,510,191
Members
408,779
Latest member
Lermiapolar

This Week's Hot Topics

  • Turn fraction around
    Hello I need to turn a fraction around, for example I have 1/3 but I need to present as 3/1
  • TIme Clock record reformatting to ???
    Hello All, I'd like some help formatting this (Tbl-A)(Loaded via Power Query) [ATTACH type="full" width="511px" alt="PQdata.png"]22252[/ATTACH]...
  • TextBox Match
    hi, I am having a few issues with my code below, what I need it to do is when they enter a value in textbox8 (QTY) either 1,2 or 3 the 3 textboxes...
  • Using Large function based on Multiple Criteria
    Hello, I can't seem to get a Large formula to work based on two criteria's. I can easily get a oldest value based one value, but I'm struggling...
  • Can you check my code please
    Hi, Im going round in circles with a Compil Error End With Without With Here is the code [CODE=rich] Private Sub...
  • Combining 2 pivot tables into 1 chart
    Hello everyone, My question sounds simple but I do not know the answer. I have 2 pivot tables and 2 charts that go with this. However I want to...
Top