Autopopulate a column based on a cell value

levans_1986

New Member
Joined
Aug 9, 2017
Messages
13
Hello :)

I am creating a survey in an excel workbook where the first tab contains a unique number for each row (survey number) and then each column has a question with a yes/no answer. There is a second tab which only needs to be completed if for example the answer to the question in column P on sheet 1 is yes.

I want the second excel sheet to be able to autopopulate the survey number if the answer to the question is yes in column P of sheet 1. This means that it is easier for the person who is completing the survey. However I'm not sure how to do this

any help appreciated :)

thanks

laura
 
Thanks thats great.
I did as you said but was getting a run time error 1004, "autofilter method of range class failed"
I changed the code from your code which said
.Range("A1:P1").Range("$A$1:$P$1000").AutoFilter Field:=16, Criteria1:="Yes"
to
.Range("A1:P1").AutoFilter Field:=16, Criteria1:="Yes"
That stopped the error and the macro runs as far as applying the autofilter

then I get another error runtime error 91, "object variable or with block variable not set"
On pressing debug this takes me to the row
AutoFilter.Range.Offset(1, 0).Copy Destination:=Worksheets("sheet2").Range("A" & LRow)

Have I screwed up here by removing the range reference?

Sorry for so many questions, I am hoping we are nearly there?? :(
 
Upvote 0

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Forum statistics

Threads
1,223,270
Messages
6,171,102
Members
452,379
Latest member
IainTru

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