Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
A real beginner with Excel 2000 [email protected] Excel Discussion (Misc queries) 3 April 16th 08 12:52 PM
Whats wrong with my code? This is a real challenge... [email protected] Excel Programming 3 February 6th 08 03:35 AM
code not working properly - VBA beginner (random numbers generation, no repeats) msburza Excel Programming 4 May 11th 06 05:59 PM
VBA Beginner: Help with Checkboxes on created User Form MarianneR Excel Programming 7 October 13th 05 03:14 AM
Beginner question: where to put code when form loads TBA[_2_] Excel Programming 4 August 31st 03 09:28 PM


All times are GMT +1. The time now is 03:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"