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

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

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,101,851
Messages
5,483,322
Members
407,393
Latest member
GeorgeBrown

This Week's Hot Topics

  • Finding issue in If elseif else with For each Loop
    Finding issue in If elseif else with For each Loop I have tried this below code but i'm getting in Y column filled with W005. Colud you please...
  • MsgBox Error
    Hi Guys, I have the below error show up when i try and run my macro in File1 but works fine if i copy and paste the same code into file2. [ATTACH...
  • CELL FORMAT - IF CONDITION
    My Cell Format is [B]""0.00" Cr". [/B]But in the cell, it is showing 123.00 for editing. (123 is entry figure). (Data imported from other...
  • Show numbers nearly the same
    Is this possible. I have a number that can change very time eg 0.00001234 Then I have a lot of numbers 0.0000001, 0.0000002, 0.00000004...
  • Please i need your help to create formula
    I need a formula in cell B8 to do this >>if b1=1 then multiply ( cell b8) by 10% ,if b1=2 multiply by 20%,if=3 multiply by 30%. Thank you in...
  • Got error while adding column and filter
    Got error while adding column and filter In column Z has some like "Success" and "Error". I want to add column in AA if the Z cell value is...
Top