PDA

View Full Version : Paste format + formula attached to " Add new " Button



noobie
01-09-2007, 06:42 PM
Hi all,
I'm sort of stuck at this. Tried to find something close to it but no avail.

Here's the problem..

when i click the ' Add new button', a dialog box would appear asking for : Description,Opening stock and specifications. After inputting, the values/ words should go to their respective cells.

The macro should also paste
- after the last row
- with the similar format and formula.


I don't if this is actually possible cause it seems too complicated. But i attached a workbook hoping it will sort of convey my idea.

Pls guide me. Thanks!:bow:

lucas
01-09-2007, 07:53 PM
For a userform to add data to the next line:
Private Sub CommandButton1_Click()
Dim LastRow As Object
Set LastRow = Sheet1.Range("a65536").End(xlUp)
LastRow.Offset(1, 0).Value = TextBox1.Text
LastRow.Offset(1, 1).Value = TextBox2.Text
LastRow.Offset(1, 2).Value = TextBox3.Text
MsgBox "One record written to Sheet1"
response = MsgBox("Do you want to enter another record?", _
vbYesNo)
If response = vbYes Then
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox1.SetFocus
Else
Unload Me
End If
End Sub
uses 3 textboxes....but you have other problems.....merged cells:jawdown: will eventually cause you problems....also you don't say whether you wish the header row inserted each time....more questions.

noobie
01-09-2007, 08:24 PM
Hi lucas,
Thanks for your reply. To make things clearer, I've attached a workbook, stating what it should look like after clicking the ' Add New button' Hope you'll find this useful.

Thanks alot in advance.
noobie

noobie
01-10-2007, 11:20 PM
just asking.. will combining a recorded macro + written macro work in this?

Pls suggest. Thanks alot.:bow: