Hi guys,
I'm really hoping someone can help me with this. I have a particular task I'm trying to do in excel and up until now no one I've asked has been able to crack it. I've been told its not possible, but I'm hoping someone here will prove them wrong.
Basically, what I'm trying to do is the following:
I have two separate spreadsheets:
- Spreadsheet A - contains a tab called "Database" in which each row is an entry. One column (B) contains a unique client code for each entry and another column (H) contains a unique code for an asset held by that client. A client can hold any number of assets and any asset can be held by more than one client.
- Spreadsheet B summarises each client's assets. Each client has its own tab with its unique identifier in cell B3, and tabs run from tab"1" to tab "36". Each tab has a list of the asset codes that the client holds from Cell B20 to Cell B60.
Periodically the database is refreshed and at the moment I have to manually filter the "Database" Tab in Spreadsheet A by each client code and copy & paste the asset numbers into the relevant client tab in Spreadsheet B. I have to repeat this for each client which take ages , so I really want to write a macro which will automate this.
The steps that I need the macro to perform are:
- Go to Tab "1" in Spreadsheet B.
- Read & remember client code in cell B3
- Go to Tab "Database" in Spreadsheet A.
- Search down column B, when value matches currently saved client code, return value in column H (asset code).
- Return to Spreadsheet B and enter value in cell B20 in Tab "1".
- Return to Tab "Database" in Spreadsheet A and carry on searching down column B and when value matches current client code, return value in column H (asset code).
- Return to Spreadsheet B and enter value in cell B21 in Tab "1".
- Return to Tab "Database" in Spreadsheet A and carry on searching down column B and when value matches current client code, return value in column H (asset code).
- Return to Spreadsheet B and enter value in cell B21 in Tab "1".
- Repeat until no more client codes match.
- Lastly, I need the above to repeat for each Tabs 1-36 in Spreadsheet B.
I been struggling with this a while as my VBA skills are very limited and I can never get the syntax correct. Any help on solving this would be very much appreciated.
Thanks,
Richard.
Bookmarks