Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Simple Button formula required

  1. #1
    Board Regular
    Join Date
    Mar 2002
    Posts
    88
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I'm very new to macro writing in Excel .. but I need the formula for a button.

    I want this button when pressed to copy the value in cell C2 to cell F2 and copy some static text (eg button name ) to cell G2

    Then .. next time the button is pressed .. it does the same thing .. copies data in cell C2 but this time to cell F3 ( or whatever is the next available row in column F ) and so on .. each time the button is pressed .. thus building up a column of numbers in column F

    How do I do this please
    thanks

  2. #2
    MrExcel MVP Jay Petrulis's Avatar
    Join Date
    Mar 2002
    Location
    Chicago, IL USA
    Posts
    2,040
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi Billm,

    Try,

    ---begin VBA---
    Sub test()
    Dim lastrow As Long

    With ActiveSheet
    lastrow = .Cells(Rows.Count, "F").End(xlUp).Row + 1
    .Cells(lastrow, "F") = .Range("C2").Value
    .Cells(lastrow, "G") = "Your text here"
    End With

    End Sub
    ---end VBA---

    This should get you started.

    HTH,
    Jay

  3. #3
    Board Regular
    Join Date
    Mar 2002
    Posts
    88
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Great .. worked first time .. thanks for your help

    Bill

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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