![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Posts: 83
|
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 |
|
MrExcel MVP
Join Date: Mar 2002
Location: Chicago, IL USA
Posts: 2,042
|
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 |
|
Board Regular
Join Date: Mar 2002
Posts: 83
|
Great .. worked first time .. thanks for your help
Bill |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|