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.
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
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, 7 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 LoungerWSralphad
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
-
Office gets current release
by
Susan Bradley
43 minutes ago -
FBI: Still Using One of These Old Routers? It’s Vulnerable to Hackers
by
Alex5723
2 hours, 20 minutes ago -
Windows AI Local Only no NPU required!
by
RetiredGeek
1 hour, 15 minutes ago -
Stop the OneDrive defaults
by
CWBillow
3 hours, 8 minutes ago -
Windows 11 Insider Preview build 27868 released to Canary
by
joep517
13 hours, 4 minutes ago -
X Suspends Encrypted DMs
by
Alex5723
15 hours, 16 minutes ago -
WSJ : My Robot and Me AI generated movie
by
Alex5723
15 hours, 34 minutes ago -
Botnet hacks 9,000+ ASUS routers to add persistent SSH backdoor
by
Alex5723
16 hours, 11 minutes ago -
OpenAI model sabotages shutdown code
by
Cybertooth
16 hours, 48 minutes ago -
Backup and access old e-mails after company e-mail address is terminated
by
M W Leijendekker
4 hours, 58 minutes ago -
Enabling Secureboot
by
ITguy
11 hours, 58 minutes ago -
Windows hosting exposes additional bugs
by
Susan Bradley
1 day ago -
No more rounded corners??
by
CWBillow
20 hours, 31 minutes ago -
Android 15 and IPV6
by
Win7and10
10 hours, 16 minutes ago -
KB5058405 might fail to install with recovery error 0xc0000098 in ACPI.sys
by
Susan Bradley
1 day, 13 hours ago -
T-Mobile’s T-Life App has a “Screen Recording Tool” Turned on
by
Alex5723
1 day, 15 hours ago -
Windows 11 Insider Preview Build 26100.4202 (24H2) released to Release Preview
by
joep517
1 day, 10 hours ago -
Windows Update orchestration platform to update all software
by
Alex5723
1 day, 23 hours ago -
May preview updates
by
Susan Bradley
1 day, 10 hours ago -
Microsoft releases KB5061977 Windows 11 24H2, Server 2025 emergency out of band
by
Alex5723
1 day, 2 hours ago -
Just got this pop-up page while browsing
by
Alex5723
1 day, 15 hours ago -
KB5058379 / KB 5061768 Failures
by
crown
1 day, 12 hours ago -
Windows 10 23H2 Good to Update to ?
by
jkitc
14 hours, 31 minutes ago -
At last – installation of 24H2
by
Botswana12
2 days, 14 hours ago -
MS-DEFCON 4: As good as it gets
by
Susan Bradley
11 hours, 18 minutes ago -
RyTuneX optimize Windows 10/11 tool
by
Alex5723
3 days, 2 hours ago -
Can I just update from Win11 22H2 to 23H2?
by
Dave Easley
1 day, 1 hour ago -
Limited account permission error related to Windows Update
by
gtd12345
3 days, 16 hours ago -
Another test post
by
gtd12345
3 days, 16 hours ago -
Connect to someone else computer
by
wadeer
3 days, 10 hours 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.