Results 1 to 6 of 6

Thread: [RESOLVED] Script to find date and transfer data from that row?

  1. #1
    New Member
    Join Date
    Jul 12
    Posts
    2

    Resolved [RESOLVED] Script to find date and transfer data from that row?

    Hi there,

    First post, and a VBA beginner here. I've been playing about with VBA for a few months, self taught using forums such as this to steal script from. I have a problem now, detailed below.

    I have a spreadsheet ("2012") with all the dates of the year in column "A". In columns C to Z there is other data pertinent to that date.
    I have a userform (FrmDateSearch) with a pop-up calendar (FrmCalendar)which allows you to select the date you wish to look at, and display the date in a textbox (DateBox).
    I would like to be able to find that date on sheet ("2012"), and then copy the values from the other boxes of that row, and reinsert them back into FrmDateSearch into textboxes with relevant names, such as export, import, stock, etc.

    I hope that makes sense! I also hope that I've posted in the right forum, apologies if not. Many thanks in advance!

    Regards,

    Iain.

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 05
    Location
    Sydney, Australia
    Posts
    80,753

    Re: Script to find date and transfer data from that row?

    If you have a question regarding VBA then the best place to ask it would be the VBA forum, not the VB.NET forum. I have asked the mods to move this thread.

  3. #3
    Super Moderator Joacim Andersson's Avatar
    Join Date
    Jan 99
    Location
    Sweden
    Posts
    13,377

    Re: Script to find date and transfer data from that row?

    Thread moved to the Office Development forum
    Joacim Andersson
    Microsoft MVP, MCSD, MCSE, Sun Certified Java Programmer
    If anyone's answer has helped you, please show your appreciation by rating that answer.
    I'd rather run ScriptBrix...
    Joacim's view on stuff.

  4. #4
    PowerPoster
    Join Date
    Dec 04
    Posts
    18,520

    Re: Script to find date and transfer data from that row?

    vb Code:
    1. set fnd = sheets("2012").range("a:a").find(frmcalandar.value)
    2. frmdatesearch.textbox1 = fnd.offset(, 1)
    3. ' fill other textboxes using the correct offsets from fnd
    change names of textboxes etc to suit, the example offset will take from column B, assumes that no invalid date is entered
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  5. #5
    New Member
    Join Date
    Jul 12
    Posts
    2

    Re: Script to find date and transfer data from that row?

    Thanks, westconn1, that works perfectly!

  6. #6
    Super Moderator koolsid's Avatar
    Join Date
    Feb 05
    Location
    Mumbai, India
    Posts
    11,405

    Re: Script to find date and transfer data from that row?

    Welcome to the forums iain_edft

    We are glad that your query is resolved.

    You might want to help us by marking the thread as resolved. This would let other experts know that your query is solved and they can skip the post if they wish to. This would help them concentrate on UNRESOLVED threads.

    If you have JavaScript enabled you can do that by selecting the Mark Thread Resolved item from the Thread Tools menu. Otherwise please insert [Resolved] at the start of the Subject and select the green check mark from the post icons. You may also visit the FAQ to see the snapshots on how it works.

    If someone has been particularly helpful you also have the ability to affect their forum reputation by rating their post. More information about rating can be found here.
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved

    Microsoft MVP: 2011 - Till Date IMP Links : Acceptable Use Policy, FAQ

    MyGear:
    Sony VGN-FZ27G with a triple boot between (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008) and (Win7+Office 2010+VS2010) || Sony VPCCB-45FN with a Win7+Office 2010+VS2010. VM: (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008), (Win8+Office 2010+VS2012) || Mac Book Pro (10.6.8) with Office 2011

Posting Permissions

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