![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Guest
Posts: n/a
|
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! |
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Bogota, Colombia
Posts: 11,927
|
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 |
|
|
|
|
|
#3 |
|
Guest
Posts: n/a
|
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? |
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|