+ Reply to Thread
Results 1 to 17 of 17

show automatically rows of created data between two dates

  1. #1
    Registered User
    Join Date
    11-16-2015
    Location
    London
    MS-Off Ver
    2013
    Posts
    51

    show automatically rows of created data between two dates

    I created a sample Form with data in the DATA sheet.

    How can I write a code that displays automatically (without press Enter or etc), the rows of existing data in DATA sheet whose date of birth is between two dates entering in the TextBox From and To?

    It does not matter if this form is in the Form sheet in Excel or in a UserForm1 (Alt + F11).

    file attached.

    Also asked in
    https://www.mrexcel.com/board/thread...dates.1215092/
    Attached Files Attached Files
    Last edited by AliGW; 08-31-2022 at 08:58 AM. Reason: URL fixed - please don't use tiny URLs here.

  2. #2
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: show automatically rows of created data between two dates

    .
    Hello.
    I show you a way to do it:

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by beyond Excel; 08-30-2022 at 06:37 AM.

  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,277

    Re: show automatically rows of created data between two dates

    No selection based on dates !
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  4. #4
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,305

    Re: show automatically rows of created data between two dates

    Form macro on orange button activates your UserForm - code in UserForm module.
    Attached Files Attached Files
    Torachan,

    Mission statement; Promote the use of Tables, Outlaw the use of 'merged cells' and 'RowSource'.

  5. #5
    Registered User
    Join Date
    11-16-2015
    Location
    London
    MS-Off Ver
    2013
    Posts
    51

    Re: show automatically rows of created data between two dates

    Thank you very much for the solutions you gave beyond Excel and torachan.

    Is it possible to add the following two possibilities to the programs:

    1- Enter the date with the data picker.

    2- While typing the date, the result displayed automatically without press the button.

  6. #6
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: show automatically rows of created data between two dates

    See what I attached.
    Attached Files Attached Files
    Last edited by AliGW; 09-02-2022 at 03:50 AM. Reason: Please DON'T quote unnecessarily!

  7. #7
    Registered User
    Join Date
    11-16-2015
    Location
    London
    MS-Off Ver
    2013
    Posts
    51

    Re: show automatically rows of created data between two dates

    Error msg:

    Could not load some objects because they are not available on this machine.
    Last edited by AliGW; 09-02-2022 at 03:50 AM. Reason: Please DON'T quote unnecessarily!

  8. #8
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,305

    Re: show automatically rows of created data between two dates

    Double click textboxes to show calendar - if manually entering dates they need to be 10 characters long (dd/mm/yyyy) to trigger search after second textbox entry.
    Date pickers look 'pretty' but I have always found them a 'faff' to use.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    11-16-2015
    Location
    London
    MS-Off Ver
    2013
    Posts
    51

    Re: show automatically rows of created data between two dates

    Excellent,

    1- Is it possible to add a delete button to each row of resulted record in ListBox, which will delete the corresponding line from the DATA sheet of excel?

    2- Is it possible to edit each row of resulted record in ListBox, so that by editing it and hitting a save button for that row, the corresponding record in the DATA sheet is also changed?

    Some like this pic
    Attached Images Attached Images
    Last edited by AliGW; 09-02-2022 at 03:49 AM. Reason: Please DON'T quote unnecessarily!

  10. #10
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,305

    Re: show automatically rows of created data between two dates

    give us a workbook file to use - pictures do not work.

  11. #11
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: show automatically rows of created data between two dates

    Quote Originally Posted by niksirat2030 View Post
    Error msg:

    Could not load some objects because they are not available on this machine.
    .
    Let's switch from Data Picker then. And it is used like this:

    - Double click to display the data picker and
    - Double click to select a date.
    Attached Files Attached Files
    Last edited by beyond Excel; 08-31-2022 at 10:41 AM.

  12. #12
    Registered User
    Join Date
    11-16-2015
    Location
    London
    MS-Off Ver
    2013
    Posts
    51

    Re: show automatically rows of created data between two dates

    Quote Originally Posted by torachan View Post
    give us a workbook file to use - pictures do not work.
    I can't create a UserForm like that.

    That picture is a screenshot of add-in Spreadsheet Boot Camp AutoMacro.

  13. #13
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,305

    Re: show automatically rows of created data between two dates

    As far as I am aware there is no way to edit the listbox directly - it is purely a selection device - the method I have used for countless years is as per the attached file.
    the form covers the norms of data input/output (ADD NEW / DELETE / UPDATE / SEARCH / VIEW)
    to add a new row first 'CLEAR' then add data and press 'ADD' to transfer to sheet - to DELETE or UPDATE select in listbox and either edit data and hit UPDATE or just hit DELETE to remove from sheet.
    to load UserForm click small green button (upper left cell)
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    11-16-2015
    Location
    London
    MS-Off Ver
    2013
    Posts
    51

    Re: show automatically rows of created data between two dates

    @beyond Excel

    I want to set header of list box equals to header of my table in DATA sheet, I use this code but returns error:

    Please Login or Register  to view this content.
    Last edited by AliGW; 09-02-2022 at 03:49 AM. Reason: Please DON'T quote unnecessarily!

  15. #15
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: show automatically rows of created data between two dates

    Try replacing:

    Please Login or Register  to view this content.
    For this other:

    Please Login or Register  to view this content.
    The idea is that:
    a) Or use RowSource,
    b) Or you use List

    It doesn't work using both methods simultaneously.
    Last edited by beyond Excel; 09-01-2022 at 06:56 PM.

  16. #16
    Registered User
    Join Date
    11-16-2015
    Location
    London
    MS-Off Ver
    2013
    Posts
    51

    Re: show automatically rows of created data between two dates

    Great, Is it possible to increase or decrease the width of the columns in the listbox in the Form when program runs by user?
    Last edited by AliGW; 09-02-2022 at 03:48 AM. Reason: Please DON'T quote unnecessarily!

  17. #17
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: show automatically rows of created data between two dates

    Quote Originally Posted by niksirat2030 View Post
    Great, Is it possible to increase or decrease the width of the columns in the listbox in the Form when program runs by user?
    ___________________________________

    I explain:

    Please Login or Register  to view this content.
    Before displaying the userform, the columns of the sheet are "resized" to their proper width using the line of code shown.
    ___________________________________

    Please Login or Register  to view this content.
    And this part of the code gives the labels the names of the table columns and passes the column widths to the listbox columns: This is automatic!
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. show how many files and extensions and last created date and show message
    By ABDELFATTA in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-12-2021, 02:58 PM
  2. Auto update of Data (Dates, Time, etc.) in next sheet created
    By raqureshi78 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-17-2019, 03:39 PM
  3. [SOLVED] Data Validation: When new row is created, creates drop down list automatically
    By Antligen in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-09-2014, 01:53 PM
  4. Automatically show rows by list
    By tmarcello935 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-18-2013, 07:43 PM
  5. Automatically filling newly created rows
    By xvxixcxtxoxr in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-18-2013, 04:43 AM
  6. VBA Created Pivot Table Doesn't Show Data
    By yawnzzzz in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-08-2008, 10:20 AM
  7. Replies: 4
    Last Post: 07-01-2005, 10:05 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1