Hi, i'm have a master spreadsheet of contact details and categories. i want to be able to pull contact information onto other sheets within the same workbook, based on category. example attached.
Hi, i'm have a master spreadsheet of contact details and categories. i want to be able to pull contact information onto other sheets within the same workbook, based on category. example attached.
Last edited by catty; 03-29-2009 at 11:12 PM. Reason: changed title as requested by moderator
Hi Catty, and welcome to the forum.
The following code should copy each row from the Master sheet to its respective sheet (Hot, Cold or Warm). It does not remove the rows from the Master sheet (although that is possible).
The code does not fill in column A on any of the Hot, Cold or Warm sheets, since that seems to be somewhat obvious. If you want it filled in automatically, that can also be done.Please Login or Register to view this content.
To add the code, right-click on the Master sheet tab, click View Code. Paste the code shown above into the VB Editor window that appears, then close the VB Editor. To run the macro, press ALT+F8, select "catty" from the list of macros, then click Run.
Hope that helps!
Hi Paul, that works but I have 2 questions:
1) the category is likely to change. If it is changed in the master sheet, does it pull through to the other sheets?
2) Is there an excel formula that can do this, instead of Visual Basic code?
Thanks!
Yes, you could do this using formulae but if you go down that route you would should strongly consider adding some "helper" cells to avoid need for Array formulae as this will slow the file... perhaps the attached may be of interest ?
(note: .xlsx extension)
Once the file is saved you could populate A1 with the name of the active sheet rather than entering manually.
I'm not saying you should disregard the VBA apparoach - pending volume of data it may well be the best option available to you
(Note: I would however advise that you adapt pjoaquin's code such that references to Range("A65536") become Cells(Rows.Count,"A"), given you're running XL2007 65536 is no longer the definitive final row available).
You could also consider using Pivot Tables of course...
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
Thanks for this - both solutions work so I will see which one I am more comfortable with!
catty, please take a few minutes to read the forum rules about thread titles (and in general) before starting your next thread. This is your freeby.
Entia non sunt multiplicanda sine necessitate
How do you get the sheets to refresh or update if you add more to the list? Ie. I added something to line 19 on the master sheet, but it didn't copy over to the Hot sheet.
Maybe run the macro again and see.
If I have helped, Don't forget to add to my reputation (click on the star below the post)
Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
Use code tags when posting your VBA code: [code] Your code here [/code]
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks