Hi All,
I am trying to create a database using Excel 2007. I have maneged to find the VBA code to enable me to save data on a separate tab of a workbook by filling in data within a form on a different tab.
The code I used is below :
Dim wsData As Worksheet
Dim wsForm As Worksheet
Dim rNextCl As Range
Sub Save_Data()
Set wsData = Sheet2
Set wsForm = Sheet1
Set rNextCl = wsData.Cells(65536, 2).End(xlUp).Offset(1, 0)
With rNextCl
.Value = wsForm.Cells(5, 4).Value
.Offset(0, 1).Value = wsForm.Cells(6, 4).Value
.Offset(0, 2).Value = wsForm.Cells(7, 4).Value
.Offset(0, 3).Value = wsForm.Cells(8, 4).Value
.Offset(0, 4).Value = wsForm.Cells(9, 4).Value
.Offset(0, 5).Value = wsForm.Cells(10, 4).Value
.Offset(0, 6).Value = wsForm.Cells(11, 4).Value
.Offset(0, 7).Value = wsForm.Cells(12, 4).Value
.Offset(0, 8).Value = wsForm.Cells(13, 4).Value
.Offset(0, 9).Value = wsForm.Cells(14, 4).Value
.Offset(0, 10).Value = wsForm.Cells(15, 4).Value
.Offset(0, 11).Value = wsForm.Cells(16, 4).Value
.Offset(0, 12).Value = wsForm.Cells(17, 4).Value
.Offset(0, 13).Value = wsForm.Cells(18, 4).Value
.Offset(0, 14).Value = wsForm.Cells(19, 4).Value
.Offset(0, 15).Value = wsForm.Cells(20, 4).Value
.Offset(0, 16).Value = wsForm.Cells(21, 4).Value
.Offset(0, 17).Value = wsForm.Cells(22, 4).Value
.Offset(0, 18).Value = wsForm.Cells(23, 4).Value
.Offset(0, 19).Value = wsForm.Cells(24, 4).Value
End With
MsgBox "Data transferred successfully" & vbCrLf & "", vbInformation, "Data transfer"
wsForm.Range("DataInput").ClearContents
Set wsData = Nothing
Set wsForm = Nothing
Set rNextCl = Nothing
End Sub
Now I am trying to include a find, amend and delete function for this database.
I would like the find function to extract the data from the seperate tab and populate this onto the form by typing a value within the form itself.
I would also like to be able to amend the data onto the form and re save this within the database.
Lastly I would like to be able to delete records
I have tried and failed! miserably to do this. Can anyone please help me! im pulling my hair out. any insight will be greatly appreciated.
I have attached a copy of the database for your viewing.
I thank you in advanced for your help!!! :-)
Bookmarks