Hi
I am wanting to copy the current stock item total from one sheet to another but I am stuck. I only know how to copy the info from a certain cell which does help me. I have attached the file any help would be gratefully appreciated
Hi
I am wanting to copy the current stock item total from one sheet to another but I am stuck. I only know how to copy the info from a certain cell which does help me. I have attached the file any help would be gratefully appreciated
You can do this with a user defined function (UDF).
Open the VBA editor (Alt F11) , add a new module by INSERT - MODULE
Paste in the following code.
return to the worksheet (Alt F11) and in D2 on the first sheet, type in =GetCurrentStockAmount(A2).![]()
Please Login or Register to view this content.
This can then be copied down to the other cells below as for any other function.
Martin
Thats brilliant thanks
![]()
A non-macro solution is to put this formula into D2 and copy down:
=INDEX(INDEX('Stock Item Record'!G:G,MATCH(A2,'Stock Item Record'!C:C,0)+7):'Stock Item Record'!G148,MATCH("",INDEX('Stock Item Record'!G:G,MATCH(A2,'Stock Item Record'!C:C,0)+8):INDEX('Stock Item Record'!G:G,MATCH(A2,'Stock Item Record'!C:C,0)+20),0),0)
Hi Martin
Is there any way the macro can be updated to take info from multiple sheets, Ive tried editing the macro you did for me but to be honest I don't really know what im doing
Cheers
I hope that this does the trick.
I've used the leftmost two characters from the SKU code to target the correct sheet.![]()
Please Login or Register to view this content.
Hi Martin
Thanks for that, but I've totally messed it up I think if you get chance will you hae a look at it for me
Cheers
The problem is that you have multiple modules, all containing a function with the same name.
If you remove all modules except for Module 5, you should be OK.
Hi Martin
Ar yes thats done the trick works fine now. Thanks again
I know I will need to add some more sheets, will the Macro stil work?
Cheers
Last edited by markransom; 11-05-2011 at 03:32 PM.
Provided that you stick to the current convention of naming the sheet with the first two letters of the SKU code, you should be OK. Please post back if this is not the case.
Hi Martin
I have added an extra colum to my spreadsheet and I've managed to stop the macro you did for me from working
If you get chance will you have a look at it for me
Cheers![]()
Try this.
![]()
Please Login or Register to view this content.
Cheers m8, works a treat much appriciated![]()
Deleted post problem sorted
Last edited by markransom; 01-14-2012 at 10:46 AM.
Hi Martin
I've been using this database all year with no problems it works perfectly, however I have just realized that items where I have inserted extra rows, the current stock value on stock list page is incorrect. I have looked at the macro and it looks like it counts down 34 lines from the stock code so when I add extra rows to a particular code the current stock value freezes at 34 rows down. Is there anyway around this?
Thanks in advance
Mark
Hi
Try this which should deal with variation in the length of the record set.
![]()
Please Login or Register to view this content.
Thanks Martin you are a star![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks