Heading for Report from UserForm.

S

shahzad4u_ksa

Hi,

I have a userform with some textboxes and comboboxes to get view the
information by selecting by textboxes and cobos. and have a
BuildReport button to find and filter the records from worksheet.

buttons are like this:

Filter Criteria:
============
1 CoboCategory:
2 CoboLocation:
3 CoboSection:
4 TxtDate:

And I have a button
Private Sub BuildReport_Click()
Sheets("Purchase").Select
Range("AT5:BH65500").Select
Selection.Copy
Sheets("RepPurchase").Select
Range("A3").Select
ActiveSheet.Paste
Range("A3").Select

Sheets("RepPurchase").Range("H1") = CoboSection.Value
' ===========================================

Sheets("Purchase").Select
Range("A1").Select
End Sub

I am using the above code to copy the filtered data to "RepPurchase"
sheet
Now the problem is this if I will use the above command then H1 shows
the name of the Section which I select, and If I select the
CoboCategory or CoboLocation how to show the different critaria in H1
as Heading of the Report.

Please help me to prepare heading for the searched critaria.

Thanks and regards.

Shahzad
KSA.
 
T

Tom Ogilvy

Select Case True
Case Trim(CoboSection.Value) <> ""
Sheets("RepPurchase").Range("H1") = CoboSection.Value
' ===========================================
Case Trim(CoboLocation.Value) <> ""
Sheets("RepPurchase").Range("H1") = CoboLocation.Value
' ===========================================
Case Trim(CoboCategory.Value) <> ""
Sheets("RepPurchase").Range("H1") = CoboCategory.Value
' ===========================================
Case Else
Sheets("RepPurchase").Range("H1") = "All Data"
' ===========================================
End Select
 

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