#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default User Form's

I am using ECEL for MAC. I wrote a USER Form to into a data base. But every
new entry erases the previous one.

Any ideals on how to fix?

Private Sub CommandButton1_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Comic Collection")

iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row

If Trim(Me.TextBook_Name.Value) = "" Then
Me.TextBook_Name.SetFocus
MsgBox "Please enter a Comic Name"
Exit Sub
End If

ws.Cells(iRow, 1).Value = Me.TextBook_Name.Value
ws.Cells(iRow, 2).Value = Me.TextPublisher.Value
ws.Cells(iRow, 3).Value = Me.TextImprint.Value
ws.Cells(iRow, 4).Value = Me.TextSeries_Began.Value
ws.Cells(iRow, 5).Value = Me.TextSeries_Ended.Value
ws.Cells(iRow, 6).Value = Me.TextFirst_Issue.Value
ws.Cells(iRow, 7).Value = Me.TextLast_Issue.Value
ws.Cells(iRow, 8).Value = Me.TextFormat.Value
ws.Cells(iRow, 9).Value = Me.TextCountry.Value
ws.Cells(iRow, 10).Value = Me.TextLanguage.Value
ws.Cells(iRow, 11).Value = Me.TextIssue_Number.Value

End Sub

Private Sub CommandButton2_Click()
Unload Me
End Sub

Private Sub TextBox1_Change()

End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, _
CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
MsgBox "Please use the button!"
End If
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default User Form's

Bill

You need to check the location first by using an if statement to see if the
location already has data in it. If it does then use an offset to get to the
next open cell with a do loop.
--
Roland


"Bill the Newbie" wrote:

I am using ECEL for MAC. I wrote a USER Form to into a data base. But every
new entry erases the previous one.

Any ideals on how to fix?

Private Sub CommandButton1_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Comic Collection")

iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row

If Trim(Me.TextBook_Name.Value) = "" Then
Me.TextBook_Name.SetFocus
MsgBox "Please enter a Comic Name"
Exit Sub
End If

ws.Cells(iRow, 1).Value = Me.TextBook_Name.Value
ws.Cells(iRow, 2).Value = Me.TextPublisher.Value
ws.Cells(iRow, 3).Value = Me.TextImprint.Value
ws.Cells(iRow, 4).Value = Me.TextSeries_Began.Value
ws.Cells(iRow, 5).Value = Me.TextSeries_Ended.Value
ws.Cells(iRow, 6).Value = Me.TextFirst_Issue.Value
ws.Cells(iRow, 7).Value = Me.TextLast_Issue.Value
ws.Cells(iRow, 8).Value = Me.TextFormat.Value
ws.Cells(iRow, 9).Value = Me.TextCountry.Value
ws.Cells(iRow, 10).Value = Me.TextLanguage.Value
ws.Cells(iRow, 11).Value = Me.TextIssue_Number.Value

End Sub

Private Sub CommandButton2_Click()
Unload Me
End Sub

Private Sub TextBox1_Change()

End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, _
CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
MsgBox "Please use the button!"
End If
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
Scrolling in a form's listbox cht13er Excel Programming 1 April 18th 08 02:38 AM
Having one form show another form's input? Lucosa New Users to Excel 3 June 13th 06 04:16 PM
Form's design change Ajit Excel Programming 0 September 16th 04 06:55 PM
Problems with a Form's behaviour Stuart[_5_] Excel Programming 0 December 22nd 03 06:43 PM
A Form's Rowsourse Format John T Ingato Excel Programming 2 October 15th 03 06:42 PM


All times are GMT +1. The time now is 03:07 AM.

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"