View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
vitorjose vitorjose is offline
external usenet poster
 
Posts: 9
Default Problem with Userform

Thanks for the help - i created a userform, using a sample downloaded
from the internet, to populate 2 lists. This is the code

Option Explicit

Private Sub CmdAddInt_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Resources")

'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row

'copy the data to the database
ws.Cells(iRow, 1).Value = Me.NameInt.Value
ws.Cells(iRow, 2).Value = Me.CompInt.Value


'clear the data
Me.NameInt.Value = ""
Me.CompInt.Value = ""
'Me.NameInt.SetFocus

Unload Me

End Sub

This routine does not work - in come cases the entry form will not
display any text as i enter it and it will not copy the entered text
into the specified worksheet. The routine shown below appears to my
untrained eyes to be identical and it does exactly what i want it to
do. Can some one help me figure out why one works but not the other.
The are contained within a multipage userform. In addtion i am
interested in learning how to program within excel - i have
significant experience in using excel but no programming experience -
can someone suggest the best way to learn programming excel vba

Thanks for your help



Private Sub CmdAddEx_Click()
Dim eRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Resources Ext")

'find first empty row in database
eRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row

'copy the data to the database
ws.Cells(eRow, 1).Value = Me.NameExt.Value
ws.Cells(eRow, 2).Value = Me.CompExt.Value


'clear the data
Me.NameExt.Value = ""
Me.CompExt.Value = ""
Me.NameExt.SetFocus

Unload Me

End Sub