Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hey everybody:
I am sort of new to this whole VBA thing and I am self teaching my self everything through the discussion groups so thank you all for writing different thing for us to read. the main reason for this post is that I am trying to make a spreadsheet that utilizes a user form to enter the data. I have never worked with combo boxes before and have two in my form. I have all the data in the drop downs - one has the date and the other has the time that we will be offering a certain service. I am trying to code something that would make it look at the spread sheet for the date selected and the time (both selected from dropdowns) but if the time was taken it shows an error message. If the date and time were both available it would then copy info from textboxes into the spreadsheet. here is what my code currently looks like: Private Sub Submit_Click() If ComboBox1.Value = ("November 21st") And ComboBox2.Value = ("8:00pm") Then ActiveWorkbook.Sheets("November 21").Activate Range("B5").Select Private Sub Place_Info() If IsEmpty(ActiveCell) = False Then ActiveWorkbook.Sheets("Main").Activate Error.Show End If If IsEmpty(ActiveCell) = True Then ActiveCell.Value = TextBox1.Value ActiveCell.Offset(0, 1) = TextBox2.Value ActiveCell.Offset(0, 2) = TextBox3.Value ActiveCell.Offset(0, 3) = TextBox4.Value ActiveCell.Offset(0, 4) = TextBox5.Value ActiveCell.Offset(0, 5) = TextBox6.Value End If If ComboBox1.Value = ("November 21st") And ComboBox2.Value = ("8:20pm") Then ActiveWorkbook.Sheets("November 21").Activate Range("B6").Select Private Sub Place_Info() If IsEmpty(ActiveCell) = False Then ActiveWorkbook.Sheets("Main").Activate Error.Show End If If IsEmpty(ActiveCell) = True Then ActiveCell.Value = TextBox1.Value ActiveCell.Offset(0, 1) = TextBox2.Value ActiveCell.Offset(0, 2) = TextBox3.Value ActiveCell.Offset(0, 3) = TextBox4.Value ActiveCell.Offset(0, 4) = TextBox5.Value ActiveCell.Offset(0, 5) = TextBox6.Value End If End Sub --So what it is doing is just reading straight through everything and not doing each combo box time as specified. I hope this all makes since and someone can assist me! Thanks so much! ~Patrick |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Running mutiple excel sheets on mutiple computers | Excel Discussion (Misc queries) | |||
Date field in user form & Loading a user form on opening workbook | Excel Programming | |||
Mutiple user edits | Excel Discussion (Misc queries) | |||
Excel 2007 User defined fucntion, cannot paste in mutiple cells | Excel Programming | |||
How to: User Form to assign a user defined range to a macro variab | Excel Programming |