Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
need code to copy/move data between sheets
I guess I need more help. I am unable to renumber the checkboxes to match the rows to link the cells. I need to see what the For...Next routine would look like. Any help would be appreciated. Ron JLGWhiz wrote: P.S. The reason I put this line in: Sheets(1).CheckBox1.LinkedCell = "A7" after deleting the row is because the delete destroys the original link. If you do not re-establish the link, you will get an error message on the next iteration of your loop. "JLGWhiz" wrote in message ... This is for a single row. To do what you want would need a few more lines of code for a loop with some If statements and range parameters for both worksheets. See the remarks after the code. Sub dk() If Range("A7").Value = "True" Then 'Copy and paste code here Rows(7).Delete Sheets(1).CheckBox1.LinkedCell = "A7" Sheets(1).CheckBox1.Value = False End If End Sub I set up a linked cell for the checkbox and then used that to test the value of the checkbox. If you use Checkboxes from the Control Toolbox and then make sure that your check boxes names are such that you can use a variable to loop through them as you walk down the column with the linked cells, you could use a For ... Next statement to test each one and do what you want. Does this help, or do you want the code written for you. "Ron Berns" wrote in message ... I am hoping someone can point me in the right direction. I have a sheet called Log and a sheet called Completed Log in an Excel 2007 workbook. I have check boxes in Column B of the Log sheet to signify if the line is complete. There could be one item that is completed or there could be ten items. I would like to create a Macro that checks each line for a marked check box. Copy the information from Column D to Column L of the Marked row on sheet Log to the next open row starting at column B in the sheet Completed Log. After the information has been moved to the Completed Log, I would like to remove the completed lines in sheet Log, uncheck the box and move the remaining lines on the Log sheet up to fill the spaces. Thank you in advance. Ron |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
need code to copy/move data between sheets
Use the checkbox from the forms Toolbar (not control toolbox) with this code. I'm checking every checkbox and then deleting the row rather than the opposite way you proposed. Sub removerows() Const BoxChecked = 1 For Each bx In ActiveSheet.CheckBoxes If bx.Value = BoxChecked Then Range(bx.LinkedCell).EntireRow.Delete bx.Delete End If Next bx End Sub "Ron Berns" wrote: I guess I need more help. I am unable to renumber the checkboxes to match the rows to link the cells. I need to see what the For...Next routine would look like. Any help would be appreciated. Ron JLGWhiz wrote: P.S. The reason I put this line in: Sheets(1).CheckBox1.LinkedCell = "A7" after deleting the row is because the delete destroys the original link. If you do not re-establish the link, you will get an error message on the next iteration of your loop. "JLGWhiz" wrote in message ... This is for a single row. To do what you want would need a few more lines of code for a loop with some If statements and range parameters for both worksheets. See the remarks after the code. Sub dk() If Range("A7").Value = "True" Then 'Copy and paste code here Rows(7).Delete Sheets(1).CheckBox1.LinkedCell = "A7" Sheets(1).CheckBox1.Value = False End If End Sub I set up a linked cell for the checkbox and then used that to test the value of the checkbox. If you use Checkboxes from the Control Toolbox and then make sure that your check boxes names are such that you can use a variable to loop through them as you walk down the column with the linked cells, you could use a For ... Next statement to test each one and do what you want. Does this help, or do you want the code written for you. "Ron Berns" wrote in message ... I am hoping someone can point me in the right direction. I have a sheet called Log and a sheet called Completed Log in an Excel 2007 workbook. I have check boxes in Column B of the Log sheet to signify if the line is complete. There could be one item that is completed or there could be ten items. I would like to create a Macro that checks each line for a marked check box. Copy the information from Column D to Column L of the Marked row on sheet Log to the next open row starting at column B in the sheet Completed Log. After the information has been moved to the Completed Log, I would like to remove the completed lines in sheet Log, uncheck the box and move the remaining lines on the Log sheet up to fill the spaces. Thank you in advance. Ron |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
need code to copy/move data between sheets | Excel Programming | |||
move or copy sheets doesn't copy format | Excel Worksheet Functions | |||
Cannot Move or Copy Sheets | Excel Discussion (Misc queries) | |||
How do I copy and move selections of data to other sheets? | Excel Worksheet Functions | |||
copy/move sheets within workbook | Excel Discussion (Misc queries) |