ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   commandbutton? (https://www.excelbanter.com/excel-programming/398395-commandbutton.html)

Bobbykm

commandbutton?
 
I am entering info into Excel Sheet1 A1, B1, C1, D1. I want to click a
button (Submit) to move info to Sheet2 A1, B1, C1, D1. After I click button
I would like Sheet1 to be ready for new entries which when Submit is clicked
again will be moved to next rows on Sheet2 (A2, B2, C2,D2).

thanks
Bobby


JLGWhiz

commandbutton?
 
Try this. It goes in the CommandButton code module, naturally.



"Bobbykm" wrote:

I am entering info into Excel Sheet1 A1, B1, C1, D1. I want to click a
button (Submit) to move info to Sheet2 A1, B1, C1, D1. After I click button
I would like Sheet1 to be ready for new entries which when Submit is clicked
again will be moved to next rows on Sheet2 (A2, B2, C2,D2).

thanks
Bobby


JLGWhiz

commandbutton?
 
I hit the post button too quick.

Sub CommandButton1_Click()
lr2 = Worksheets("Sheet2").Cells(Rows.Count, 1).End(xlUp).Row
Worksheets("Sheet1").Range("A1:D").Cut Worksheets("Sheet2").Range("A" & lr)
CutCopyMode = False
End Sub

"Bobbykm" wrote:

I am entering info into Excel Sheet1 A1, B1, C1, D1. I want to click a
button (Submit) to move info to Sheet2 A1, B1, C1, D1. After I click button
I would like Sheet1 to be ready for new entries which when Submit is clicked
again will be moved to next rows on Sheet2 (A2, B2, C2,D2).

thanks
Bobby


FSt1

commandbutton?
 
hi,
another way, without using cut and paste.
Private Sub cb1_Click()
Dim fr As Range
Dim sr As Range
Set sr = Sheet2.Range("A65536").End(xlUp).Offset(1, 0)
Set fr = Range("A65536").End(xlUp)
sr.Value = fr.Value
sr.Offset(0, 1).Value = fr.Offset(0, 1).Value
sr.Offset(0, 2).Value = fr.Offset(0, 2).Value
sr.Offset(0, 3).Value = fr.Offset(0, 3).Value

End Sub
regards
FSt1

"Bobbykm" wrote:

I am entering info into Excel Sheet1 A1, B1, C1, D1. I want to click a
button (Submit) to move info to Sheet2 A1, B1, C1, D1. After I click button
I would like Sheet1 to be ready for new entries which when Submit is clicked
again will be moved to next rows on Sheet2 (A2, B2, C2,D2).

thanks
Bobby



All times are GMT +1. The time now is 10:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com