PC Review


Reply
Thread Tools Rate Thread

Coding Help: Copy Checked Rows to Another Sheet

 
 
No Spam
Guest
Posts: n/a
 
      12th Dec 2005
Dear Excel 2003 Users,

Has anyone ever done the following:

On a worksheet, have a series of rows, where there is a place in
Column A to place a checkmark.

The user would go through and check the rows that are needed to create
a "client to-do checklist".

Somewhere on the sheet, there would be a button that would copy only
the lines that are checked and either put them on a new worksheet or
into a new workbook. If it is easier to delete the unchecked rows,
that would also be great, I would base the initial document on a
template to keep it intact.

It would be greatly appreciated if anyone can share some code to
accomplish this. Thanks a million in advance!

Kevin
 
Reply With Quote
 
 
 
 
Jason
Guest
Posts: n/a
 
      13th Dec 2005
I'm no vba expert, but this should work:

--------------------------------------------------------
Sub CopyRows()

Dim X, Y

X = 1

For Y = 1 To 50
If Range("A" & Y).Value = "X" Then
Range("A" & Y).EntireRow.Copy
Sheets("Sheet2").Select
Range("A" & X).Select
ActiveSheet.Paste
X = X + 1
Sheets("Sheet1").Select
End If
Next Y

End Sub
------------------------------------------------------------

This will just copy the rows (from 1 to 50) that have an "X" in column
A on Sheet1. However, if you run it a second time, it won't delete the
rows that were copied the first time. So, if you copy 10 rows the
first time and five rows the second, you'll still see ten rows of data.


One other thing, for some reason, this code doesn't work if you put it
in the button. You'll have to write this in a module and run that from
the button.

Hopefully, this makes sense and is what you were looking for.

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy rows from one Data sheet to another sheet based on cell conte John McKeon Microsoft Excel Misc 2 15th May 2010 06:49 AM
Copy rows onto existing sheet / start a new sheet if full mg_sv_r Microsoft Excel Programming 0 29th Nov 2007 12:57 PM
Search for rows in one sheet and copy into another sheet based on customer id chitiksha@gmail.com Microsoft Excel Worksheet Functions 1 22nd Oct 2007 03:09 AM
Help: auto-copy entire rows from 1 sheet (based on cell criteria) to another sheet. bertbarndoor Microsoft Excel Programming 4 5th Oct 2007 04:00 PM
copy if checkbox checked to sheet two =?Utf-8?B?QmlsbHlSb2dlcnM=?= Microsoft Excel Programming 1 28th Feb 2006 08:32 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:35 AM.