PDA

View Full Version : [SOLVED] How to populate data from one sheet to another?



pivotguy
04-07-2016, 05:38 PM
I have 4 tabs in excel spreadsheet


Output (13 Records)
Show (search Button): VBA code attached and working fine.
Requirement
List of Values

The idea is to display data from “Output” sheet based onsearch criteria (Zip Code) and display in “Show” sheet. I have written a VBAcode on “SEARCH” button and data is perfectly populated in “SHOW” sheet. No Issue.

Currently data can only search by Zip code. I would like to search by territory, first name, last name, region and name ‘wild card” search etc. See the “requirement” dropdown values sheet.

Any suggestion how to enhance the VBA code?

Bob Phillips
04-08-2016, 04:00 AM
Is it supposed to work as Zip OR Territory, or Zip AND Territory?

Louwelyn
04-08-2016, 05:34 AM
Hi pivotguy,
I have tried two things:
- On "show" sheet, you have a dropdown menu and the lookup uses a wild card, meaning if you are looking for "7" for a zip code, it will return 00077 and 71254 records
- On "requirement" sheet, I added another dropdown list in C3 that is populated when the A3 list value changes: so you can't use wild cards but you have all possible entries that are proposed for any given section.


In my opinion both solutions will work nicely if you don't have too many data. If you have a few thousands lines, it could be better to use autofilter to extract results.

pivotguy
04-08-2016, 12:51 PM
Louwelyn: Your code worked except a small glitch.

Show Tab:

First Name: M

It should return all first name where letter “M” exist. Itreturned all values of first name “MELISSA”. But it also return “FIRST NAME”under First Name (Column C) because the letter “M” exist under label “FirstName”. The record should return only data, not column header.

Louwelyn
04-08-2016, 09:10 PM
Ooops, my bad, I forgot to check that.
In every For i = 2 To finalrow and For j = 2 To finalrow replace 2 by 3, it will begin to search from the 3rd row instead of the 2nd.

pivotguy
04-09-2016, 07:24 AM
Louweyn Yes, the code is working .Thank for your time and effort. The issue is resolved