Hi. I have a list of items. I want to be able to select some of the items and copy them to another sheet. I want to place a “Yes” in a cell in the row of each item I need to copy. When the row has a “Yes”, I want it to copy each item with a “Yes” and place them in another sheet. I would like to do this with a macro/VBA. Can someone show me how to do this? I think it is probably simple. If more information is needed or the above doesn’t make any sense, let me know. Thanks.
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Don’t know what to call it (Excel 97, SR2)
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Don’t know what to call it (Excel 97, SR2)
- This topic has 8 replies, 5 voices, and was last updated 23 years, 6 months ago.
Viewing 2 reply threadsAuthorReplies-
WSGraemeH
AskWoody LoungerSeptember 25, 2001 at 2:36 pm #543997Lonnie,
This is one way, if I’ve understood you correctly:The items are in cells A1:A20 and the ‘yes’s are in cells B1:B20; Sheet2 contains a title for the new list in cell A1
Sub CopyItems()
Dim cl As Range
For Each cl In Range(“A1:A20”)
If cl.Offset(,1).Value = “yes” Then
cl.Copy Destination:=Sheet2.Range(“A65536”).End(xlUp).Offset(1)
End If
NextEnd Sub
As ever, I’m sure there are more elegant ways!
HTH
graeme
-
WSLonnieB
AskWoody LoungerSeptember 27, 2001 at 11:53 am #544333Hi, graeme. Thanks for your help. It has gotten me a long way, but I need a little more help.
This is your code that I revised slightly:
****************************************************
Sub CopyItems()Dim CopyYes As Range
For Each CopyYes In Range(“I38:I200”)
If CopyYes.Value = “y” Then
CopyYes.EntireRow.Copy Destination:=Sheet2.Range(“A65536:J65536”).End(xlUp).Offset(1)End If
NextEnd Sub
*****************************************************What I would like to do now is to copy and paste to the destination just the values that exist in the EntireRow. I can’t seem to find where in the CopyYes line to place a PasteSpecial xlValue thingy. It may be that the PasteSpecial goes on the next line. I don’t know. Anyway, I just need a little more nudge.
Thanks again.
-
-
WSkieran
AskWoody Lounger -
WSralphad
AskWoody LoungerSeptember 26, 2001 at 1:02 pm #544152This is also not too neat, but it’s only one line of VBA….
Create another range, with matching column headings as your list, with the word ‘yes’ below the column header which will contain ‘yes’ in your list. Call that range ‘criteria’.
If your original list range is called ‘myrange’ and your target range for the copied records is ‘targetrange’ then the following line if VBA will do your work:-
Range("myrange").AdvancedFilter xlFilterCopy, Range("criteria"), Range("targetrange")
-
WSLonnieB
AskWoody LoungerOctober 30, 2001 at 3:08 pm #549266Hi, Adam. You provided VBA code similar to what is below and it worked for my purpose at the time.
Sub CopyItems()
Dim CopyYes As RangeSheets(“CopyTo”).Range(“A7:FA220”).ClearContents
For Each CopyYes In Range(“H1:H211”)
If CopyYes.Value = “y” Or CopyYes.Value = “Y” Or CopyYes.Value = “Yes” _
Or CopyYes.Value = “yes” Or CopyYes.Value = “YES” Then
CopyYes.EntireRow.Copy
Sheets(“CopyTo”).Range(“A65536:FA65536”).End(xlUp).Offset(1).PasteSpecial Paste:=xlAll
End IfNext
End SubI now need to be able to find a “Yes” value in the Range(“H1:H211”), but I only need to copy about six non-contiguous cells to another worksheet. The CopyYes.EntireRow.Copy doesn’t work for what I need. I have tried CopyYes.Range(“A1, D1:G1, B1”).Copy, but, of course, that doesn’t work. Can this be done? If you need more info, please ask. TIA
-
H. Legare Coleman
AskWoody Plus
-
-
Viewing 2 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Giving UniGetUi a test run.
by
RetiredGeek
1 hour, 24 minutes ago -
Windows 11 Insider Preview Build 26100.4188 (24H2) released to Release Preview
by
joep517
9 hours, 1 minute ago -
Microsoft is now putting quantum encryption in Windows builds
by
Alex5723
7 hours ago -
Auto Time Zone Adjustment
by
wadeer
13 hours, 30 minutes ago -
To download Win 11 Pro 23H2 ISO.
by
Eddieloh
11 hours, 10 minutes ago -
Manage your browsing experience with Edge
by
Mary Branscombe
16 minutes ago -
Fewer vulnerabilities, larger updates
by
Susan Bradley
2 hours, 42 minutes ago -
Hobbies — There’s free software for that!
by
Deanna McElveen
6 hours, 59 minutes ago -
Apps included with macOS
by
Will Fastie
6 hours, 37 minutes ago -
Xfinity home internet
by
MrJimPhelps
6 hours, 32 minutes ago -
Convert PowerPoint presentation to Impress
by
RetiredGeek
6 hours, 30 minutes ago -
Debian 12.11 released
by
Alex5723
1 day, 10 hours ago -
Microsoft: Troubleshoot problems updating Windows
by
Alex5723
1 day, 14 hours ago -
Woman Files for Divorce After ChatGPT “Reads” Husband’s Coffee Cup
by
Alex5723
17 hours, 46 minutes ago -
Moving fwd, Win 11 Pro,, which is best? Lenovo refurb
by
Deo
10 hours, 11 minutes ago -
DBOS Advanced Network Analysis
by
Kathy Stevens
2 days, 7 hours ago -
Microsoft Edge Launching Automatically?
by
healeyinpa
1 day, 21 hours ago -
Google Chrome to block admin-level browser launches for better security
by
Alex5723
2 days, 9 hours ago -
iPhone SE2 Stolen Device Protection
by
Rick Corbett
2 days, 2 hours ago -
Some advice for managing my wireless internet gateway
by
LHiggins
1 day, 9 hours ago -
NO POWER IN KEYBOARD OR MOUSE
by
HE48AEEXX77WEN4Edbtm
11 hours, 42 minutes ago -
A CVE-MITRE-CISA-CNA Extravaganza
by
Nibbled To Death By Ducks
2 days, 19 hours ago -
Sometimes I wonder about these bots
by
Susan Bradley
7 hours, 31 minutes ago -
Does windows update component store “self heal”?
by
Mike Cross
2 days, 5 hours ago -
Windows 11 Insider Preview build 27858 released to Canary
by
joep517
3 days, 9 hours ago -
Pwn2Own Berlin 2025: Day One Results
by
Alex5723
1 day, 17 hours ago -
Windows 10 might repeatedly display the BitLocker recovery screen at startup
by
Susan Bradley
1 day, 5 hours ago -
Windows 11 Insider Preview Build 22631.5409 (23H2) released to Release Preview
by
joep517
3 days, 12 hours ago -
Windows 10 Build 19045.5912 (22H2) to Release Preview Channel
by
joep517
3 days, 12 hours ago -
Kevin Beaumont on Microsoft Recall
by
Susan Bradley
17 minutes ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.