Results 1 to 6 of 6

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

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2012
    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
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

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

    Thread moved to the Office Development forum

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    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

    Thread Starter
    New Member
    Join Date
    Jul 2012
    Posts
    2

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

    Thanks, westconn1, that works perfectly!

  6. #6
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    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


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

Posting Permissions

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



Click Here to Expand Forum to Full Width