Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
need code to copy/move data between sheets Ron Berns Excel Programming 3 June 25th 09 01:41 PM
move or copy sheets doesn't copy format ColinX Excel Worksheet Functions 1 May 14th 08 10:07 PM
Cannot Move or Copy Sheets Toys Excel Discussion (Misc queries) 1 June 20th 07 12:59 PM
How do I copy and move selections of data to other sheets? JEZ838 Excel Worksheet Functions 1 November 3rd 06 03:38 PM
copy/move sheets within workbook Roger B. Excel Discussion (Misc queries) 1 May 5th 05 05:43 PM


All times are GMT +1. The time now is 04:55 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"