database

pradyuthal

Board Regular
Joined
Jul 13, 2005
Messages
212
1) i want to have a button which will save data from the template to the database automatically after hitting the button enabling the create new record.

2) I would also like to get the data entry cells clear by way of creating a clear / new button .

Please provide me with the suitable codes .

Thanks in advance .
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Please provide me with the suitable codes .

It'll help greatly in the future if you specify the ranges, otherwise all you can count on getting is an ambiguous response that you'll have to adjust for yourself. That said, how's this for a start:

<font face=Tahoma><SPAN style="color:#00007F">Sub</SPAN> foo()
    <SPAN style="color:#007F00">'   Copy Data to a recordset</SPAN>
    <SPAN style="color:#00007F">Dim</SPAN> LastRow <SPAN style="color:#00007F">As</SPAN> Range
    <SPAN style="color:#00007F">Dim</SPAN> i <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN>
        <SPAN style="color:#00007F">Set</SPAN> LastRow = Sheets("Sheet2").Cells(Rows.Count, "A").End(xlUp)
    
            <SPAN style="color:#00007F">For</SPAN> i = 1 <SPAN style="color:#00007F">To</SPAN> 5
                LastRow.Offset(1, i - 1) = ActiveSheet.Cells(1, i)
                ActiveSheet.Cells(1, i) = ""
            <SPAN style="color:#00007F">Next</SPAN> i
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>

It copies range A1:A5 on the activesheet to a new recordset and clears the copied cells.

HTH,

Smitty
 
Upvote 0
my template is as follows :
test11.xls
ABCD
1
2
3namegggggg
4Addresskkkkkkkkkk
5yyyyyyy
6rrrrrrr
7
8
9slname of itemamount
101fff566
11
12
13
14
15previous due200
16paid400
17due166
18total due366
19
Sheet1


my database structure is as follows :
test11.xls
ABCDEFGHIJK
1nameAddressname of itemamountprevious duepaidduetotal due
Sheet2


Please provide me with suitable code so that the entered records are copied automatically inti sheet 2 and clears data so entered in the template sheet 1 .
 
Upvote 0

Forum statistics

Threads
1,214,830
Messages
6,121,835
Members
449,051
Latest member
excelquestion515

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