LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 29
Default Creating A Form

I have created a simple inventory form. I am not very familiar with VBE, but
found a simple code I can use to run it.

How do I add to the code to sum the total of parts available, i.e.
=sumif(a2:A10="New entry")?

Here is the form layout:

Part No:
Location:
Date Received:
Number Recieved:
Amount On Hand: (Need formula)

Here is the code:

Private Sub cmdAdd_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")

'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.txtPart.Value) = "" Then
Me.txtPart.SetFocus
MsgBox "Please enter a part number"
Exit Sub
End If

'copy the data to the database
ws.Cells(iRow, 1).Value = Me.txtPart.Value
ws.Cells(iRow, 2).Value = Me.txtLoc.Value
ws.Cells(iRow, 3).Value = Me.txtDate.Value
ws.Cells(iRow, 4).Value = Me.txtQty.Value

'clear the data
Me.txtPart.Value = ""
Me.txtLoc.Value = ""
Me.txtDate.Value = ""
Me.txtQty.Value = ""
Me.txtPart.SetFocus

End Sub

Thanks for all your help!
Johnnie


 
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
Creating a Form Claudine Excel Worksheet Functions 2 December 5th 06 10:59 PM
Creating a form oakridge Excel Worksheet Functions 0 May 18th 06 01:22 PM
creating a form aprylddd New Users to Excel 1 September 20th 05 09:45 AM
Creating a Form Marcia3641 Excel Discussion (Misc queries) 10 July 21st 05 06:15 PM
Creating a Search Form Karen Excel Discussion (Misc queries) 12 April 1st 05 07:02 AM


All times are GMT +1. The time now is 02:29 PM.

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

About Us

"It's about Microsoft Excel"