Consulting

Results 1 to 4 of 4

Thread: Paste format + formula attached to " Add new " Button

  1. #1

    Paste format + formula attached to " Add new " Button

    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!

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    For a userform to add data to the next line:
    [VBA]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[/VBA]
    uses 3 textboxes....but you have other problems.....merged cells will eventually cause you problems....also you don't say whether you wish the header row inserted each time....more questions.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    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

  4. #4
    just asking.. will combining a recorded macro + written macro work in this?

    Pls suggest. Thanks alot.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •