Home Vba code to retrieve an entire column from sheet1 if the value in a cell of sheet2 matches the value of a header in sheet1
Reply: 0

# Vba code to retrieve an entire column from sheet1 if the value in a cell of sheet2 matches the value of a header in sheet1

user776
1#
user776 Published in July 21, 2018, 1:46 pm
 I'm trying to find vba code that will bring the contents of an entire column in "sheet1" to "sheet2" if the value in cell A1, matches one of the headers in "sheet1" below is what I have so far: Sub searchdata() Dim lastrow As Long, x As Long lastcolumn = Sheets("Practice Associations").Cells(Columns.Count,.End(xlToRight) For y = 1 To lastcolumn If Sheets("Practice Associations").Cells(y, 1).Value = Sheets("Sheet2").Range("A1").Value Then Sheets("Sheet2").Range("A2:A1000").Value = Sheets("Sheet1").Column(x, 1).Value  Basically, I'm trying to build a dashboard that will pull a list of values if the value searched in a search box matches one of the headers in the table. Any help is appreciated! Thanks in advance.
 You need to login account before you can post.
Processed in 0.326487 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO