ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Getting sheet to find data (https://www.excelbanter.com/excel-programming/382371-getting-sheet-find-data.html)

Dan V

Getting sheet to find data
 
Hi everyone
I'm designing a meeting room booker and I have created a form for users to
interact with. On the form is a date/time picker, a hidden text box and
several labels.
The idea is this: the user chooses the date, the text box fills with the
chosen date from the date picker. Using the date in the text box, the labels
(each representing a time slot) retrieve the value of a cell in a worksheet
(where all the data will be stored) corresponding to the relevant date.

However, it falls fown when trying to find the row relevant to the date they
are searching for...

Private Sub btnCheck_Click()
z = 1
Do Until Sheet1.Cells(z, 1) = txtDate.Value
z = z + 1
Loop
frmBooker.lbl8slot.Caption = Sheet1.Cells(z, 2)
End Sub

I get a runtime error 1004. Any help would be gratefully appreciated.

Thanks
Dan

Jim Cone

Getting sheet to find data
 
Dan,

Dim z as Long
'--
Do Until Me.Cells(z, 1).Text = Me.Shapes("txtDate").TextFrame.Characters.Text
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Dan V" <Dan
wrote in message
Hi everyone
I'm designing a meeting room booker and I have created a form for users to
interact with. On the form is a date/time picker, a hidden text box and
several labels.
The idea is this: the user chooses the date, the text box fills with the
chosen date from the date picker. Using the date in the text box, the labels
(each representing a time slot) retrieve the value of a cell in a worksheet
(where all the data will be stored) corresponding to the relevant date.

However, it falls fown when trying to find the row relevant to the date they
are searching for...

Private Sub btnCheck_Click()
z = 1
Do Until Sheet1.Cells(z, 1) = txtDate.Value
z = z + 1
Loop
frmBooker.lbl8slot.Caption = Sheet1.Cells(z, 2)
End Sub

I get a runtime error 1004. Any help would be gratefully appreciated.

Thanks
Dan


All times are GMT +1. The time now is 02:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com