![]() |
| ||
| Macro for "Sumif/Vlookup" Hello, i am working on a macro where i need to copy data from a sheet to a different sheet in the same workbook. i normally use "vlookup" or "Sumif" or "Sumproduct" formulae to do the job. the datas is quite large and it takes ages to refresh the data when i use "Sumif" or "Vlookup". i am looking for a macro which could replace these formulae. I have included a short example of the database. Sheet1 has the data and it should be pasted on Sheet2 by looking in Sheet1 column "Code" should be used as a condition. for every "700" there are a few value and they should be taken from Sheet1 and pasted in Sheet2 corresponding to the "Client". same with other "Codes" and i might need to add the Balances in sum instances. thank you in advance for your help, Shah |
| ||
| Re: Macro for "Sumif/Vlookup" you're looking for a specific value in sheet1 to pasted in sheet2? or you need to do calculation first in sheet1 and after doing the calculation you'll find for a specific result and copy over to sheet2? is it what you're trying to do or what? |
| ||
| Re: Macro for "Sumif/Vlookup" well thank you for your reply, I would not have to calculate anything as all the values are already in the database. i would need to find a specific result and copy over to sheet2. i hope this helps, thanks, Shah |
| ||
| Re: Macro for "Sumif/Vlookup" try this.. it will find a specific value..then copy the whole rows to sheet2.. just modify it to suit your needs.. hope it helps.. Dim x as boolean |
| ||
| Re: Macro for "Sumif/Vlookup" thank you cguan, the code works fine. i was wondering if i could run a loop on this as the code stops after looking at the first value in sheet1 and copies it to sheet2. Also is it possible to give it more than one codition lets say it looks in sheet2 column1 for a value and copy a value from sheet1 column 3 corresponding to the value in sheet2 column1 and a condition in sheet1 column2. i hope i have explained it ok. thank you |
| ||
| Re: Macro for "Sumif/Vlookup" yes it is possible to look for a value in sheet column1 and copy a value from sheet1 column3 but what you mean by "and a condition in sheet1 column2"? |
| ||
| Re: Macro for "Sumif/Vlookup" 1 Attachment(s) thank for getting back to me, well i have attached a small example. sheet1 has three columns "Client", "Code" and "Balance" and sheet2 has two columns "Client"and "Balance". i want to copy data from Sheet1 "Balance" to Sheet2 "Balance". the data should correspond to the "client" column. there are many entries in "Code" but i am just interested in a few. lets say "Code" is "700" and i want to copy "balance" for Client "0014" and past it in sheet2 "Balance" corresponding to the client. i hope this will help, btw i was able to loop the macro but as it is not dynamic it just keeps on going through the sheets and copies nothing. thank you for your help. |
| ||
| Re: Macro for "Sumif/Vlookup" hi shahji, try this, hope it helps... ;) Sub Macro1() |
| ||
| Re: Macro for "Sumif/Vlookup" hey Cguan, i have tried the above but it copies the macro to sheet2 rather than any data. any ideas why is that? thanks |
| ||
| Re: Macro for "Sumif/Vlookup" try this.. :) Sub Macro1() |
| All times are GMT -4. The time now is 9:12 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC