is there anyone master in excel..??

fanku

New Member
Joined
Sep 20, 2006
Messages
30
Hi Friends..

I have created data entry form using excel-vba.
any one can tell me how can i save data into excel entries are done though VBA form, i am entering basic data.

File no :
name :
date of birth :
address :

basic :
hra :
conv :

pf = basic * 12%
gross = basic+hra+conv - should calculate automatically
fileno shld generate automatically.
***************
Private Sub cmdAdd_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("PartsData")

'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.id.Value) = "" Then
Me.id.SetFocus
Exit Sub
End If

'copy the data to the database
ws.Cells(iRow, 1).Value = Me.id.Value
ws.Cells(iRow, 2).Value = Me.gender.Value
ws.Cells(iRow, 3).Value = Me.mname.Value
ws.Cells(iRow, 4).Value = Me.add1.Value
ws.Cells(iRow, 5).Value = Me.add2.Value
ws.Cells(iRow, 6).Value = Me.add3.Value
ws.Cells(iRow, 7).Value = Me.phone.Value
ws.Cells(iRow, 8).Value = Me.cell.Value
ws.Cells(iRow, 9).Value = Me.dob.Value
ws.Cells(iRow, 10).Value = Me.doj.Value

ws.Cells(iRow, 11).Value = Me.edu1.Value
ws.Cells(iRow, 12).Value = Me.coll1.Value
ws.Cells(iRow, 13).Value = Me.yr1.Value

ws.Cells(iRow, 14).Value = Me.edu2.Value
ws.Cells(iRow, 15).Value = Me.coll2.Value
ws.Cells(iRow, 16).Value = Me.yr2.Value

ws.Cells(iRow, 17).Value = Me.exp.Value
ws.Cells(iRow, 18).Value = Me.lastcomp.Value
ws.Cells(iRow, 19).Value = Me.lastdesig.Value
ws.Cells(iRow, 20).Value = Me.appointed.Value
ws.Cells(iRow, 21).Value = Me.grade.Value
ws.Cells(iRow, 22).Value = Me.dept.Value
ws.Cells(iRow, 23).Value = Me.loc.Value
ws.Cells(iRow, 24).Value = Me.hold.Value

' Salary Details
ws.Cells(iRow, 24).Value = Me.basic.Value
ws.Cells(iRow, 25).Value = Me.hra.Value
ws.Cells(iRow, 26).Value = Me.conv.Value
ws.Cells(iRow, 27).Value = Me.others.Value
ws.Cells(iRow, 28).Value = Me.mf.Value
***************************** till here i can do it...but how to do following calculation and save to excel..??

ws.Cells(iRow, 29).Value = Me.pf.Value
ws.Cells(iRow, 30).Value = Me.esic.Value
ws.Cells(iRow, 31).Value = Me.gross.Value
'ws.Cells(iRow, 32).Value = Me.fbonus.Value

ws.Cells(iRow, 38).Value = Me.driver.Value
ws.Cells(iRow, 39).Value = Me.mobile.Value
ws.Cells(iRow, 40).Value = Me.laptop.Value



'clear the data
Me.id.Value = ""
Me.mname.Value = ""
Me.dob.Value = ""
Me.id.Value = ""
Me.gender.Value = ""
Me.mname.Value = ""
Me.add1.Value = ""
Me.add2.Value = ""
Me.add3.Value = ""
Me.phone.Value = ""
Me.cell.Value = ""
Me.dob.Value = ""
Me.doj.Value = ""

Me.edu1.Value = ""
Me.coll1.Value = ""
Me.yr1.Value = ""

Me.edu2.Value = ""
Me.coll2.Value = ""
Me.yr2.Value = ""

Me.exp.Value = ""
Me.lastcomp.Value = ""
Me.lastdesig.Value = ""
Me.appointed.Value = ""
Me.grade.Value = ""
Me.dept.Value = ""
Me.loc.Value = ""
Me.hold.Value = ""

Me.id.SetFocus

End Sub

***************
regards
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Hello,

I would have a button on the form to run the code. Depending on the layout of the spreadsheet you would need something like


Code:
Private Sub CommandButton1_Click()
RANGE("A65536").end(xlup).offset(1,0).value=textbox1.text
End Sub

is this enough to be getting on with?
 
Upvote 0
send me ur email address ...
i want to send u my excel file..so, u will get clear idea..
and ur help will gain my knowledge..

i want to learn excel-vba script..

Thanks
 
Upvote 0

Forum statistics

Threads
1,213,489
Messages
6,113,954
Members
448,535
Latest member
alrossman

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top