[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.
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.
Re: Script to find date and transfer data from that row?
Thread moved to the Office Development forum
Re: Script to find date and transfer data from that row?
vb Code:
set fnd = sheets("2012").range("a:a").find(frmcalandar.value)
frmdatesearch.textbox1 = fnd.offset(, 1)
' 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
Re: Script to find date and transfer data from that row?
Thanks, westconn1, that works perfectly!
Re: Script to find date and transfer data from that row?
Welcome to the forums iain_edft :wave:
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 http://www.vbforums.com/images/icons/completeclear.gif 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.