Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help please - real beginner at form code
Hi, I have the following code in a form but do not know how to do the
following with it. 1. The CmbSiteList is a combo box and I do not know how to generate the options as there are many and chaning. This would contain a list of company names that is ever growing. These company names are on the sheet 'Dates' but are determined by another sheet which is the master list. Entries in the 'Dates' sheet calculate new data for the master list also. 2. When I copy the data to the database I want only the entry in CmbSiteList updated with what is in the text box TxtDate. Please can someone help as the code I have so far I have taken from http://www.contextures.on.ca/xlUserForm01.html#SetUp and have not written myself as I would not know how. Private Sub SaveVisit_Click() Dim iRow As Long Dim ws As Worksheet Set ws = Worksheets("Dates") 'find first empty row in database iRow = ws.Cells(Rows.Count, 1) _ .End(xlUp).Offset(1, 0).Row 'check for a part number If Trim(Me.TxtDate.Value) = "" Then Me.TxtDate.SetFocus MsgBox "Please enter a valid Date" Exit Sub End If If Trim(Me.CmbSiteList.Value) = "" Then Me.CmbSiteList.SetFocus MsgBox "Please select a Site" Exit Sub End If 'copy the data to the database ws.Cells(iRow, 1).Value = Me.CmbSiteList.Value ws.Cells(iRow, 2).Value = Me.TxtDate.Value 'clear the data Me.CmbSiteList.Value = "" Me.TxtDate.Value = "" Me.CmbSiteList.SetFocus End Sub Private Sub CloseVisit_Click() Unload Me End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
A real beginner with Excel 2000 | Excel Discussion (Misc queries) | |||
Whats wrong with my code? This is a real challenge... | Excel Programming | |||
code not working properly - VBA beginner (random numbers generation, no repeats) | Excel Programming | |||
VBA Beginner: Help with Checkboxes on created User Form | Excel Programming | |||
Beginner question: where to put code when form loads | Excel Programming |