|
-
Jul 17th, 2012, 06:58 AM
#1
Thread Starter
New Member
[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.
-
Jul 18th, 2012, 02:40 AM
#2
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.
-
Jul 18th, 2012, 02:54 AM
#3
Re: Script to find date and transfer data from that row?
Thread moved to the Office Development forum
-
Jul 18th, 2012, 04:52 AM
#4
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
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
-
Jul 20th, 2012, 04:04 AM
#5
Thread Starter
New Member
Re: Script to find date and transfer data from that row?
Thanks, westconn1, that works perfectly!
-
Jul 20th, 2012, 05:47 AM
#6
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|