Hide Blank rows from ListBox1

S

Shazi

Hi,

I am using the below code in my userform, to hide unwanted blank rows
in Listbox,


My data is coming after filtration procedure to AP5:AY
filtered data is veriable, some times 5 rows and some time 50 rows
and
some time 70 rows. I want to see only the filtered rows in the list
box.


but this procedure is not working in my new form.


your procedure is working in other file, but in this file its making
problem.


Option Explicit


Dim LastRow As Long


Private Sub Userform_Initialize()


Sheets("DailyIssue").Select


'for Listbox Scrol bar hide unwanted rows.
LastRow = Worksheets("DailyIssue").Cells(Rows.Count,
"a").End(xlUp).Row
ListBox1.RowSource = "AP5:AY" & LastRow


StartDate = ""
EndDate = ""
MaterialName = ""
CoboCategory = ""
TxtTRNo = ""
CoboEmployee = ""
StartDate.SetFocus


End Sub


Private Sub CommandButton1_Click()


range("A4:J5000").AdvancedFilter Action:=xlFilterCopy,
CriteriaRange:=range _
("AP1:AY3"), CopyToRange:=range("AP4:AY500"), Unique:=False


Selection.End(xlUp).Select


Sheets("DailyIssue").Select
range("AP3:AY3") = ""


End Sub


Can you check where is the mistake.


Best Regards


Syed Shahzad Zafar
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top