Excel VB coding help

ssavvidis

New Member
Joined
May 18, 2015
Messages
9
I have created a list of names with a series of drop down boxes of questions in the connected rows. What I'm looking for is that in the list, there is a list of names in one column and the other columns have drop down lists with yes and now. In column F, if "yes" is selected I want the entire row to be copied to sheet 2, in a new list of all the yes answered rows.
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
I would like to post an attachment of the actual spreadsheet for reference but for some reason it says that I'm not allowed to post attachments.
 
Upvote 0
Not to keep spamming my own post but one more option that might be simpler. If the value in column f is yes, then to copy row to sheet two in a new list.
 
Upvote 0
Well, if I understand you correctly, what you want the macro to do is to copy the entire row based on the value in column F. I also assume that sheet 2 already exists. If so you could try this (although it's not the fastest way to go)
Give it a try and tell us if you have any kind of problem or are looking for a more efficient method (It may depend on the amount of data to analyze)

Sub NewList()
Dim LastRow As Long
LastRow = Sheets(2).Range("F65536").End(xlUp).Row
Sheets(1).Activate
Range("F1").Select
Do While ActiveCell.Value <> ""
If ActiveCell.Value = "Yes" Then
ActiveCell.EntireRow.Copy Destination:=Sheets(2).Rows(LastRow)
LastRow = LastRow + 1
End If
ActiveCell.Offset(1, 0).Select
Loop
End Sub
 
Last edited:
Upvote 0
Ok, These are the steps you should follow in order to try the macro.
1. Open the workbook that contains the data to process.
2. Press Alt + F11
3. In the new window that appears, look the upper-right menu named VBAProject, right click inside it and select Insert - Module.
4. Note an empty page that appears in the left side (that’s the new module). You should paste the code there.
5. To execute the macro, just place the cursor in the code and press F5.

I hope this help you to try the macro.
As I said before, I’ll be glad to help in case you have any problem with the procedure.
Also remember there are other ways to complete this task, which may result more convenient for large amounts of data, so let me know if you need to speed up the macro.
 
Upvote 0
Doesn't work. Is there a way that I can upload my spreadsheet for you guys to look at and have a better idea of what im looking for?
 
Upvote 0
Explain exactly what you mean by
In column F, if "yes" is selected I want the entire row to be copied to sheet 2

What do you mean by "selected" that it gets moved if you click on the cell, right click the cell, click a button, something else?
 
Upvote 0
As far as I know you can't attach the workbook here, however I guess you could use an external uploading service and then post the link to download it.
By the way, when you say that that the macro didn't work, it's because you get an error message when running it or because it just doesn't perform the required actions?
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,198
Members
449,072
Latest member
DW Draft

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top