input box
I want to use a date input into an input box. Every syntax combination I try
refused by compiler. Help please? |
input box
Is this what you want?
'Put the value of A1 in TextBox1 on UserForm1 UserForm1.TextBox1.Text = Range("A1") 'Open Userform1 UserForm1.Show -- Ronald Ferdinandus http://www.ro-pay.nl "Matilda" wrote: I want to use a date input into an input box. Every syntax combination I try refused by compiler. Help please? |
input box
Hi Ronald - I'm so glad you're still up on a Sunday (as it is here) and
helping out newbies :-) I want user to input desired date into inputBox, then I want to use that date to access a range of associated data. I have columns of data stored under date headings. With your lovely little routine I can now move through the column and get out the data I want and put it into a print area. I hope I have explained myself better, Ta muchly "RonaldF" wrote: Is this what you want? 'Put the value of A1 in TextBox1 on UserForm1 UserForm1.TextBox1.Text = Range("A1") 'Open Userform1 UserForm1.Show -- Ronald Ferdinandus http://www.ro-pay.nl "Matilda" wrote: I want to use a date input into an input box. Every syntax combination I try refused by compiler. Help please? |
input box
Dim dt as Date, res as Variant
Dim res1 as Variant res = InputBox("Please enter the date") if isdate(res) then dt = Cdate(res) res1 = Application.Match(clng(dt),Rows(1),0) if not iserror(res1) then msgbox format(dt,"mmm dd, yyyy") & _ " found at column " & res1 else msgbox format(dt,"mmm dd, yyyy") & _ " not found" end if Else Msgbox res & " is not a date" End if -- Regards, Tom Ogilvy "Matilda" wrote in message ... Hi Ronald - I'm so glad you're still up on a Sunday (as it is here) and helping out newbies :-) I want user to input desired date into inputBox, then I want to use that date to access a range of associated data. I have columns of data stored under date headings. With your lovely little routine I can now move through the column and get out the data I want and put it into a print area. I hope I have explained myself better, Ta muchly "RonaldF" wrote: Is this what you want? 'Put the value of A1 in TextBox1 on UserForm1 UserForm1.TextBox1.Text = Range("A1") 'Open Userform1 UserForm1.Show -- Ronald Ferdinandus http://www.ro-pay.nl "Matilda" wrote: I want to use a date input into an input box. Every syntax combination I try refused by compiler. Help please? |
input box
Tom,
Your elegant code works a dream, thankyou. Matilda "Tom Ogilvy" wrote: Dim dt as Date, res as Variant Dim res1 as Variant res = InputBox("Please enter the date") if isdate(res) then dt = Cdate(res) res1 = Application.Match(clng(dt),Rows(1),0) if not iserror(res1) then msgbox format(dt,"mmm dd, yyyy") & _ " found at column " & res1 else msgbox format(dt,"mmm dd, yyyy") & _ " not found" end if Else Msgbox res & " is not a date" End if -- Regards, Tom Ogilvy "Matilda" wrote in message ... Hi Ronald - I'm so glad you're still up on a Sunday (as it is here) and helping out newbies :-) I want user to input desired date into inputBox, then I want to use that date to access a range of associated data. I have columns of data stored under date headings. With your lovely little routine I can now move through the column and get out the data I want and put it into a print area. I hope I have explained myself better, Ta muchly "RonaldF" wrote: Is this what you want? 'Put the value of A1 in TextBox1 on UserForm1 UserForm1.TextBox1.Text = Range("A1") 'Open Userform1 UserForm1.Show -- Ronald Ferdinandus http://www.ro-pay.nl "Matilda" wrote: I want to use a date input into an input box. Every syntax combination I try refused by compiler. Help please? |
All times are GMT +1. The time now is 07:27 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com