User Form
VBA Telemetry pings you when your VBA projects fail
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: User Form

  1. #1
    Guest

    Default

     
    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. #2
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Bogota, Colombia
    Posts
    11,959
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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

    Regards,

    Juan Pablo González
    http://www.juanpg.com

  3. #3
    Guest

    Default

      
    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?

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com