User Form

G

Guest

Guest
I have a list of documents with expiration dates. I was using a message box to show which documents have expired, but the message box is too small to fit the entire list.

I am now trying to use a user form, but I cannot get it to display the documents. I pasted the code that I am using for the query (see below) into a label box on the userform, but when I run it, it comes up blank. Here is the code:

Dim Z, Q As Integer
Dim GN, GD As String
Dim Response4, Msg4, Title4, Style4

Sheets(1).Activate

For Q = 2 To Range("A65536").End(xlUp).Row
GT = Range("E" & Q)
If Now() - 1095 > GT Then GN = GN & " " & Range("E" & Q) & " " & Range("A" & Q) & Chr$(13)
Next Q

Msg4 = ("THE FOLLOWING DOCUMENTS HAVE EXPIRED: " & vbLf & GN)
Title4 = "Expired Documents"
Style4 = vbCritical

Response4 = MsgBox(Msg4, Style4, Title4, Help, Ctxt)

Any suggestions?
Thanks!
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
How about in your new userform put a ListBox, and in the Initialize Event of the UserForm, place this code:

Private Sub UserForm_Initialize()
ListBox1.RowSource = "Sheet1!A2:A" & Sheets("Sheet1").Range("A65536").End(xlUp).Row
End Sub
 
Upvote 0
Thanks Juan,
It looks like this will fit my needs. How would I set it to filter the entries by date? Right now, the list box will show Everything that's in Column A. How can I get it so that it will show those values in column A whose corresponding values in column D (dates) fall within a particular date range?
 
Upvote 0

Forum statistics

Threads
1,215,583
Messages
6,125,665
Members
449,247
Latest member
wingedshoes

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
Back
Top