+ Reply to Thread
Results 1 to 12 of 12

code selection range

  1. #1
    Forum Contributor
    Join Date
    09-22-2007
    Posts
    119

    code selection range

    Hi,if my excel file data in column a:h, and in column a is date data in every day. i try to know how to write vba code in the case of selection data by the date, that i want to select for any propose (copy or printing). eg. date data "dd/mm/yyyy" when i put it to input box
    thank

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Your requirement is unclear to me.

    If Col A only has date's then select Col A up to use range ??

    To check for date try IsDate e.g

    Please Login or Register  to view this content.
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Forum Contributor
    Join Date
    09-22-2007
    Posts
    119
    sorry,VBA Noob
    i mean my selection range a:h depend on the date i do, if i want to copy data the a:h of the date 12/9/2008 my selection range is (a19:h23 )the green area of my example . or if i key in 02/9/2008 in the input box the selection area will be a6:h8 etc.
    thank for your help
    Attached Files Attached Files

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Why not enter the date you want in a cell (K1) and then use conditional formatting

    =$A1=$K$1
    Note Select Cols A to H first

    VBA Noob

  5. #5
    Forum Guru mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,230
    Perhaps AutoFilter will do what you want.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  6. #6
    Forum Contributor
    Join Date
    09-22-2007
    Posts
    119
    Hi,i try to use autofilter to serch data that i want and then copy to sheet2, but i can not do . any one can help me why it not working,please
    Attached Files Attached Files

  7. #7
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Example on site if you search

    Links should also help

    http://www.ozgrid.com/VBA/autofilter-vba-dates.htm
    http://www.rondebruin.nl/copy5.htm

    VBA Noob

  8. #8
    Forum Contributor
    Join Date
    09-22-2007
    Posts
    119
    Thank,VBA Noob
    your links,help me more. now I can do it. date format is the problem.
    thank,for your response

  9. #9
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    date format is the problem
    What's problem you having. Post a sample file with the code you have so far

    VBA Noob

  10. #10
    Forum Contributor
    Join Date
    09-22-2007
    Posts
    119
    I change by add some code ...Dim a AS Date
    and j1 is the date format as data date in sheet1
    Attached Files Attached Files

  11. #11
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Seem to work ok.

    Could amend to

    Please Login or Register  to view this content.
    VBA Noob

  12. #12
    Forum Contributor
    Join Date
    09-22-2007
    Posts
    119
    Thank,for your best code it work well.
    pichai

+ 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. Replies: 9
    Last Post: 06-06-2009, 12:09 PM
  2. Code to find #N/A in a range
    By Divot in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-20-2008, 04:19 AM
  3. date range selection
    By Tracey Mingo in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-19-2008, 08:05 AM
  4. Range Selection-When I click on a cell a form opens up?
    By GavinExcel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-30-2007, 07:35 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