Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I want to run a macro that does this" On sheet 1, I fill in A1 with data. I click a button and it copies it over to A1 on sheet 2. Then, on sheet 1, I fill in A1 with something else. I click the button again and it copies it into the next available row which would be A2. Can someone please point me in the right direction. Thanks so much, Joel |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Joel,
Try this. Open a new workbook and place a button on the sheet. Right click on the button and click properties. Change the name to btnSendToSheet2. If you double click your button the VBE will open. Copy the following code and give it a try. Private Sub btnSendToSheet2_Click() Dim vData As Variant Dim lRow As Long vData = Cells(1, 1) With Sheets(2) lRow = .UsedRange.Rows.Count If IsEmpty(.Cells(1, 1)) Then .Cells(1, 1) = vData Else .Cells(lRow + 1, 1) = vData End If End With End Sub "Joel" wrote: Hello, I want to run a macro that does this" On sheet 1, I fill in A1 with data. I click a button and it copies it over to A1 on sheet 2. Then, on sheet 1, I fill in A1 with something else. I click the button again and it copies it into the next available row which would be A2. Can someone please point me in the right direction. Thanks so much, Joel |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you so much for your help. You were more help than you know!
-Joel "DB" wrote: Joel, Try this. Open a new workbook and place a button on the sheet. Right click on the button and click properties. Change the name to btnSendToSheet2. If you double click your button the VBE will open. Copy the following code and give it a try. Private Sub btnSendToSheet2_Click() Dim vData As Variant Dim lRow As Long vData = Cells(1, 1) With Sheets(2) lRow = .UsedRange.Rows.Count If IsEmpty(.Cells(1, 1)) Then .Cells(1, 1) = vData Else .Cells(lRow + 1, 1) = vData End If End With End Sub "Joel" wrote: Hello, I want to run a macro that does this" On sheet 1, I fill in A1 with data. I click a button and it copies it over to A1 on sheet 2. Then, on sheet 1, I fill in A1 with something else. I click the button again and it copies it into the next available row which would be A2. Can someone please point me in the right direction. Thanks so much, Joel |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro recorded... tabs & file names changed, macro hangs | Excel Worksheet Functions | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
how to count/sum by function/macro to get the number of record to do copy/paste in macro | Excel Programming | |||
macro to delete entire rows when column A is blank ...a quick macro | Excel Programming | |||
Start Macro / Stop Macro / Restart Macro | Excel Programming |