Select row in worksheet1 and move to first available row of worksheet2

marcley467

New Member
Joined
Oct 13, 2015
Messages
7
Hi, I have not used VBA in quite a few years and I have looked through all the posted questions & answers and tried to combine/manipulate the code but have had no luck.

I would appreciate it if anyone could help me with a code to copy the data within a select a row of a worksheet named “Open” to the first available row in worksheet, named “Closed”. Both worksheets are in the same workbook.

If possible, I would like to select the row being moved by clicking in one of the cells within that row.

After selecting the row, I would like the user to push a button located at the top of the sheet to run the code to move the row, etc..

After the data has moved, the original row can be automatically deleted from worksheet named "Open" and the document saved.

Thanks for your help.
BJ
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Here you go!

Code:
Sub marcley()

Dim Lrow As Integer

Lrow = Sheets("Closed").Cells(Rows.Count, 1).End(xlUp).Row

Selection.EntireRow.Copy Destination:=Sheets("Closed").Cells(Lrow + 1, 1)
Selection.EntireRow.Delete
ActiveWorkbook.Save

End Sub
 
Upvote 0
Hi, thank you so much for you help. I am not sure what I have done wrong.... I moved one row of data, then selected a 2nd row of data to move and it copied over the first row I moved instead of adding it.
 
Upvote 0
This could be happening if the data it copied over in column A is blank. The macro is figuring out what last row to copy to by looking at the last entry in column A. If column A has blanks then it might be best to look at a column the does not have blanks. If you post an example workbook, I might have a better idea as to why this isn't working.

Thanks,

-Max
 
Upvote 0
This could be happening if the data it copied over in column A is blank. The macro is figuring out what last row to copy to by looking at the last entry in column A. If column A has blanks then it might be best to look at a column the does not have blanks. If you post an example workbook, I might have a better idea as to why this isn't working.
Thanks,

-Max


Hi, Max:

Sorry about that this works perfectly now. I had not looked to make sure the all the columns had text. the ones that I selected did not have data in the 1 column.
Thanks again. :o)
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top