Hopefully this is an easy one.....
I have two sheets "barcodes" and "input". The code works, but I cant get the loop to stop?
Any ideas - example attached!
Many thanks
Hopefully this is an easy one.....
I have two sheets "barcodes" and "input". The code works, but I cant get the loop to stop?
Any ideas - example attached!
Many thanks
Maybe you can explain what you are trying to achieve with your code?
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]
Maybe try this (untested):
abousettaPlease Login or Register to view this content.
Last edited by abousetta; 09-19-2012 at 06:31 AM.
Please consider:
Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.
Hi abousetta,
It doesn't work because the variable "r" is undefined? Not sure what to change here?
Thanks
Hi arlu1201,
What i'm trying to do is input a unique bar code against the stock number in the "input" sheet. Once this is done i need to then put that stock number against the barcode in "barcodes" sheet.
Thanks
r As Long
added it above
I can't get it to work, its hanging on the line?
PHP Code:
.Range("A3:A" & r + 1) = Sheets("Barcodes").Range("A2:A" & r)
Can you walk me through what you want the macro to do? I'm sure it's a minor tweak but if you elaborate I should be able to fix it with less effort.
abousetta
I have a list of Barcodes in the "barcode" sheet.
I then have a list of stock numbers in the "input" sheet.
I need the macro to take the last unused barcode in the selection "barcodes" and assign it to the next stocknumber (without a barcode assigned)in "input". To complete the task the barcode needs to have the stock number assigned in the "barcode" sheet as well.
So in theory when I update stock numbers (i.e. put in new ones) I can automatically assign a new barcode.
I need the macro to stop when it runs out of barcodes, and ideally pop up with an error.
I hope that makes sense
@Abousetta, the "r" is supposed to be LR, which is what is causing the error. You assigned LR a value, but never assigned r a value, so the range "A2:A" & r becomes "A2:A0" which is causing the error because there is no "A0" cell. Haven't read the rest of what he needs, but that is why the code is erroring.
Hope that helps,
~tigeravatar
Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble
Hi TA,
Yes, I changed strategies mid coding and didn't account for it. It was way too early in the morning and I hope to get a look at after work when I can concentrate. It's not a difficult task from the OP's description.
abousetta
Hi, can anyone shed any light on this yet? I feel the answer is at my fingertips but i cant quite get there!!
Thank you so much!!!
Hi,
Try this out. I tested the possible scenarios I could think of. Let me know if you need any further tweaks.
abousettaPlease Login or Register to view this content.
Perfect, this works brilliantly! Thank you so much!
Glad I was able to assist.
Good luck.
abousetta
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks