View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Simon Lloyd[_1265_] Simon Lloyd[_1265_] is offline
external usenet poster
 
Posts: 1
Default Help with a form in excel.


Angela, you can add a date picker (RoyUk has added one here
http://www.thecodecage.com/forumz/do...ndar-form.html you
may have to join for free to download it), i again haven't looked at
your workbook, you can join our forums (shown in the link below) it's
completely free, if you do join you will have the opportunity to add
attachments to your posts so you can add workbooks to better illustrate
your problems and get help directly with them. Also if you do join
please post in this thread (link found below) so that people who have
been following or helping with this query can continue to do so. :)

Other than that and some minore issues in your code i see no problems
:)

Angela;522470 Wrote:
Hello Simon,

I have made some changes, but I'm unable to get the desired results.
The date needs to be in a text box. I was thinking may be we can add a
calendar option as to pick date from a calendar.
I hope you download the file once & have a look at it to get a better
idea.... I'm sure you'll get to know the requirement.

I have added a sheet1 with the ranges which will serve as a temp sheet
for combo box data.

'---------------------
SCRIPTSTART------------------------------------------------

Code:
--------------------

Private Sub UserForm_initialize()
'declare our variables
Dim Rng As Range
Dim MyCell As Range
Dim RngLoc As Range
Dim MyLoc As Range

'set a range to work with
Set Rng = Sheets("Sheet1").Range("A2:A" & Sheets("Sheet1").Range("A"
& Rows.Count).End(xlUp).Row)
Set RngLoc = Sheets("Sheet1").Range("b2:b" & Sheets("Sheet1").Range
("b" & Rows.Count).End(xlUp).Row)

'For Item
For Each MyCell In Rng
Me.ComboBox1.AddItem (MyCell)
Next MyCell

'For Location
For Each MyLoc In RngLoc
Me.ComboBox2.AddItem (MyLoc)
Next MyLoc
Me.TextBox3.Text = Format(Me.TextBox3.Text, "dd/mm/yyyy")
End Sub
Private Sub CommandButton1_Click()
Dim X As Long
Dim LastColumn As Long
Dim Number1 As Variant
Dim Number2 As Variant
Dim TBox1 As String
Dim TBox2 As String
TBox1 = Trim(TextBox1.Text)
TBox2 = Trim(TextBox2.Text)
If TBox1 = "" Or TBox2 = "" Then
MsgBox "You must fill in both text boxes!"
ElseIf TBox1 Like String(Len(TBox1), "#") And Len(TBox2) < 29 Then
Number1 = CDec(TBox1)
If TBox2 Like String(Len(TBox2), "#") And Len(TBox2) < 29 Then
Number2 = CDec(TBox2)
If Number2 < Number1 Then
MsgBox "Ending number must contain an equal or larger number
than Starting!"
Else
LastColumn = Cells(1, Columns.Count).End(xlToLeft).Column
If LastColumn = 1 And Range("A3").Value = "" Then LastColumn =

For X = 0 To Number2 - Number1
Cells(X + 1, LastColumn + 1).Value = _
"'" & Format$(Number1 + X, String(Len(Trim(TBox1)),
"0"))
Next
End If
Else
MsgBox "Bad entry in Ending text box"
End If
Else
MsgBox "Bad entry in Starting text box"
End If
End Sub

--------------------
'--------------------------------

SCRIPTEND--------------------------------------

Link to the new file is as follow:
'Generate_List_required.xls - download now for free. File sharing.
Software file sharing. Free file hosting. File upload.
FileFactory.com'
(http://www.filefactory.com/file/a0g0...t_required_xls)

Thank you


(shown in the link below) it's completely free, if you do join you
will have the opportunity to add attachments to your posts so you can
add workbooks to better illustrate your problems and get help directly
with them. Also if you do join please post in this thread (link found
below) so that people who have been following or helping with this query
can continue to do so. :)


--
Simon Lloyd

Regards,
Simon Lloyd
'Microsoft Office Help' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=143196