+ Reply to Thread
Results 1 to 46 of 46

Select Relevant Text till not exist. First Script.

  1. #1
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Select Relevant Text till not exist. First Script.

    Please Login or Register  to view this content.
    Simple script, I think it should work, but I keep getting an error (Variable not defined), I know what it means, but I didn't think I actually had a variable.

    Can someone help me please? Sorry if I seem to be missing the basics, but unthankfully work throws me into situations I am not comfortable being in, but unthankfully work is exactly that and the job market still sucks.
    Last edited by Cyberpawz; 03-20-2012 at 11:28 AM.

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: My first script, and I need a little help.

    Cyberpawz,

    I'm not sure what the macro is trying to do. It is always checking the same cell, G2, to see if it is empty. If G2 is not empty, the macro doesn't do anything. If G2 is empty, the macro goes into an infinite loop. All it seems to do is select a row, then go down to the next cell in column A, over and over again.

    What's the end goal for this macro?
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: My first script, and I need a little help.

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Re: My first script, and I need a little help.

    G2? Gah, well anyway... I thought I got that numbering wrong.

    It was meant to check B6... so I got to switch that.

    First off here is the sheet.

    This is being exported straight from a program, an annoying little thing in where it needs major rework....not by me cause I never would of designed it. In any case, the script is meant to do this: If B6 has text, select the row and go one step down, and continue to go down B till there is more text in B itself.

    From there I am going to copy all the data and then push it to another page in another workbook in where a bunch of other things are going to happen inside excel itself, but if I get this part done 50% of my problems are solved I think. Probably not, but I need to start somewhere.
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Re: My first script, and I need a little help.

    Quote Originally Posted by royUK View Post
    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.
    Sorry it's been a long day, I normally don't do that type of pleading in my posts, but right now I'm getting frustrated because I have my bosses at the back of my throat attempting to make me hurry, when I told them I don't know how to do this, but since I am their "MS Guru" it doesn't matter to them.

  6. #6
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Select Relevant Text till not exist. First Script.

    Cyberpawz,

    Something like this?
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Re: Select Relevant Text till not exist. First Script.

    Thanks, sorry about not giving more info at first I was under the gun and I was able to get more time to actually learn VBA, but not enough to learn what I need in such a short amount of time, but here is what I need...boss just changed what was required, for the setup here a third tab is going to have to be inputted, called archive.


    This is what I am attempting to do.
    I have one book with three tabs.

    JobsList.xlsx is the book. JobsList and BackOrder and Archive are the tabs.

    BackOrder is the imported export file from a program called Fishbowl and will be changing weekly. (Never use this program if you have a choice).


    On A1 and A2 I want to create a button that does the steps below automatically.
    1. In the BackOrder tab, On B6 there is an alphanumeric name, I want that row to be selected.
    2. Go down one row, if there is text there select that row.
    3. Continue till text is no longer prevalent.
    4. Copy selected rows.
    5. Paste into a new tab, move columns G to F, L to I, and N to J.
    6. Copy all text.
    7. In the Jobs List tab, Move all rows that don’t have “SAME” in column “N” to archive tab, then organize all remaining so that they are all at the top of the list, if there are any left in the first place.
    8. Paste into tab JobsList, after last row with text in it. paste the data from the temporary tab.
    9. Delete just created tab, and end script.

    What I'd also like to see if possible, but I don't know how to word it, is that the script in M &N will be duplicated as the rows continue down, and stop when the rows of data end... these columns will be hidden to the end user on purpose. They don't need to see this part.

    That is it, yes I know I make it sound simple, but this is what I need, or my bosses need…
    I am learning Excel VBA to make this happen, but I have a feeling I am far away from making this happen.

    Thanks for your help, this is greatly appreciated.
    Attached Files Attached Files
    Last edited by Cyberpawz; 03-22-2012 at 11:30 AM. Reason: Boss just changed requirements again...Argh!

  8. #8
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Select Relevant Text till not exist. First Script.

    Cyberpawz,

    Attached is a modified version of your recent workbook. It contains the following macro which should accomplish what you're looking for:
    Please Login or Register  to view this content.


    I changed formula in column M from a sumproduct (ineffecient and slow due to whole column use) to countifs. I also copied the formats and formulas to row 1 columns M:X of the JobsList sheet and hid those columns. They are used in the macro to provide formatting and formulas to the new data.
    Attached Files Attached Files
    Last edited by tigeravatar; 03-22-2012 at 02:37 PM.

  9. #9
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Re: Select Relevant Text till not exist. First Script.

    This works well, thanks, but I have a question, if I looked at the data from my form, then compared to yours, the import function should of only imported 6 fields, for a total of 15, not 26... Did the script just copy over everything again instead of only copying over the ones that weren't duplicates?

    I'm not being unappreciative, you got me a hell of a lot closer to the end result than I could of my own in the time you took, but I just want to know so I can understand the code better myself

    Thanks again for the script, you did amazing work under such a short amount of time.

  10. #10
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Select Relevant Text till not exist. First Script.

    I'm not sure what you mean, I can't find where you're getting those numbers.

    In the example file you posted, Jobs List v2.xlsx‎:
    • In the Jobs List tab, there are 63 records that do not have "Same" in column N, so those were the records moved to the Archive worksheet.
    • In the Jobs List tab, there are 9 records that have "Same" in column N so those records were left alone
    • In the BackOrder tab, there are 15 records (B6:B20) that you want to import to the Jobs List tab
    • After the macro is run, those 15 records are imported to the Jobs List tab, so 9+15 = 24 records in there now.


    This line is where it filters for items that do not have Same in column N of the Jobs List tab (before importing from the BackOrder tab):
    Please Login or Register  to view this content.


    Basically, I don't understand what should happen vs what is happening. From what I can see, the macro performs as expected, unless I am misunderstaning a requirement?

  11. #11
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Re: Select Relevant Text till not exist. First Script.

    Quote Originally Posted by tigeravatar View Post
    I'm not sure what you mean, I can't find where you're getting those numbers.

    In the example file you posted, Jobs List v2.xlsx‎:
    • In the Jobs List tab, there are 63 records that do not have "Same" in column N, so those were the records moved to the Archive worksheet.
    • In the Jobs List tab, there are 9 records that have "Same" in column N so those records were left alone
    • In the BackOrder tab, there are 15 records (B6:B20) that you want to import to the Jobs List tab
    • After the macro is run, those 15 records are imported to the Jobs List tab, so 9+15 = 24 records in there now.


    This line is where it filters for items that do not have Same in column N of the Jobs List tab (before importing from the BackOrder tab):
    Please Login or Register  to view this content.


    Basically, I don't understand what should happen vs what is happening. From what I can see, the macro performs as expected, unless I am misunderstaning a requirement?
    Ok, here is what I mean, out of those 73, only 9 of them have the word "Same" on column 'N'. So when the script runs, all but 9 should be deleted. If you go to the BackOrder tab you'll see there are 15 rows, now if 9 of them are duplicates only 5 should be transferred over. That means the 5 that should be transferred over are new, and the others should be ignored.

    Sorry if I wasn't making sense before. Is there a way to make it so if "Same" shows up on Jobs List to ignore said line in BackOrder?, so that only those with "Same" in the row isn't transferred over, but everything else is? Sorry I didn't make as much sense as I thought I did. Sometimes your own mind is your own worst enemy.
    Last edited by Cyberpawz; 03-22-2012 at 03:24 PM.

  12. #12
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Select Relevant Text till not exist. First Script.

    Ooh, I see. In that case, it would be easier to delete everything in the Jobs List sheet and then import the items from the BackOrder.

    Change this section:
    Please Login or Register  to view this content.


    To this instead:
    Please Login or Register  to view this content.

  13. #13
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Re: Select Relevant Text till not exist. First Script.

    Quote Originally Posted by tigeravatar View Post
    Ooh, I see. In that case, it would be easier to delete everything in the Jobs List sheet and then import the items from the BackOrder.

    Change this section:
    Please Login or Register  to view this content.


    To this instead:
    Please Login or Register  to view this content.
    Except that if you see there is a Remarks area in the JobsArea, we need to keep the Remarks from what was already there because of the fact that work has already been done with them inside Excel. Otherwise I'd agree, but the user for this is going to be adding comments into excel, not fishbowl, so the comments will not be transferred over from the import.

    What I need is this, people will press an import data button (which I'll create), and the script will run and do this:

    So what will probably have to happen is this:
    1. Copy script on O5 & P5 down till last row of data so script can run. (this row will be hidden)
    2. Copy all rows that don't say "Same" on 'N' to Archive, at the bottom of the data that may already be there.
    3. Delete all rows that don't say "Same" on 'N' on Jobs List.
    4. Copy all data from BackOrder that say "Different" to Jobs List (not copying Columns O and P.)
    5. Copy script on M2 & N2 on Jobs List, down till last row of data so script can run again on next import.(this row will be hidden)

      I hope this helps. I've uploaded another version with your script change, and my changes as well. So you will get an idea of what I'm looking for.

      Thanks again for the help.
    Attached Files Attached Files

  14. #14
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Re: Select Relevant Text till not exist. First Script.

    Ok, I have been reading your script, the original and I am getting a little confused. Can you explain to me what is going on?

    Please Login or Register  to view this content.
    Variables, this I understand.

    Please Login or Register  to view this content.
    Setting up settings within excel?

    Please Login or Register  to view this content.
    Any code within tab Jobs List Copy to the Archive tab, and then delete any row that does not have the word "Same" in row 'N'.

    Please Login or Register  to view this content.
    Select all rows in BackOrder till data ends starting at B6, move G to F, I to L, and J to N. Copy all rows to Jobs List.

    Please Login or Register  to view this content.
    No Idea.

    Please Login or Register  to view this content.
    Re-Adjusting settings in Excel?

  15. #15
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Re: Select Relevant Text till not exist. First Script.

    Ok, I have been tweaking the code, sorry but got bored and boss was looking at me asking what I was doing....

    So I've done HTML, and XHTM coding and looking at the code, thinking that I can solve the issue myself, I've solved 90% of it, it does almost exactly what I want, but it is copying data that shouldn't be copied from BackOrder, namely the Shortage list and below.

    Also, I've yet to figure out how to copy the script so that the code can be run a second time from the hidden rows. I can't just paste the code all the way down or it will always copy over the shortage summary list... which I don't want to do.

    Thanks for looking, and getting me this far.

    Please Login or Register  to view this content.
    Last edited by Cyberpawz; 03-23-2012 at 10:46 AM.

  16. #16
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Select Relevant Text till not exist. First Script.

    Quote Originally Posted by Cyberpawz View Post
    Ok, I have been reading your script, the original and I am getting a little confused. Can you explain to me what is going on?

    Please Login or Register  to view this content.
    No Idea.

    You are correct on everything you mentioned. That section copies the formatting and formulas that are hidden in M1:X1 and applies it to all items in the Jobs List worksheet after the import, so that it looks consistent and the formulas are already populated.

  17. #17
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Re: Select Relevant Text till not exist. First Script.

    Quote Originally Posted by tigeravatar View Post
    You are correct on everything you mentioned. That section copies the formatting and formulas that are hidden in M1:X1 and applies it to all items in the Jobs List worksheet after the import, so that it looks consistent and the formulas are already populated.
    Thanks for clarifying, I've been taking my XHTML coding experience trying to grab at ideas of what each part does, when I do that the language actually make more sense.

    Also, I've tweaked your code a little, and come up with a problem, if you could look at it and tell me what is wrong it be greatly appreciated.

    http://www.excelforum.com/excel-prog...=1#post2741427

  18. #18
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Re: Select Relevant Text till not exist. First Script.

    Ok, the problem is more than I thought... I'm going back to the drawing board on my side, if you can help me with a solution it be greatly appreciated.

  19. #19
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Select Relevant Text till not exist. First Script.

    Took a look at the changes and requirements, give this a shot, should do the trick:
    Please Login or Register  to view this content.

  20. #20
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Re: Select Relevant Text till not exist. First Script.

    This works perfectly, the only question I have is that will this make the scripts in BackOrder on O & P and Jobs List M & N copy the way down? If yes, where is the code in what you gave me? The only reason I ask is because the variables are always changing...

    Thanks again, this works great, I really wish I had more time to learn this the way you have It be so much easier to do things in Excel...

  21. #21
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Select Relevant Text till not exist. First Script.

    Cyberpawz,

    This line copies the formulas in Jobs List M & N down:
    Please Login or Register  to view this content.
    As for BackOrder O & P, that data is imported from fishbowl. The macro could add a line towards the beginning to put in the formulas for those columns i suppose. I'd recommend putting those formulas in the Jobs List sheet in cells Y1 and Z1. And then you could use that to copy and paste the formula to column O and P in the backorder sheet, similar to how the above line operates

  22. #22
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Re: Select Relevant Text till not exist. First Script.

    So to make it would, would it be beneficial to add the line of code after this?

    Please Login or Register  to view this content.

  23. #23
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Select Relevant Text till not exist. First Script.

    Changed my mind. Because its on a different sheet, it'd probably be easiest to input the formula directly, just before filtering for "<>Different", like this;

    Please Login or Register  to view this content.


    Full code with the change:
    Please Login or Register  to view this content.

  24. #24
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Re: Select Relevant Text till not exist. First Script.

    Ok, I am seeing that you have added in the script from excel, a little different than how I had it, but I am looking at the script and I am actually liking the original concept first. Only because it seems to me that it seems a little more "clean"?

    But with what you have you are looking at only doing
    Please Login or Register  to view this content.
    and not
    Please Login or Register  to view this content.
    on Jobs List, and
    Please Login or Register  to view this content.
    and
    Please Login or Register  to view this content.
    on BackOrder.

    If I do the copy fields the way you suggested before wouldn't it be less confusing? I'm just curious, because reading books about this so far I've been learning K.I.S.S. is still the best way to run things...

    I may be completely off base, please tell me if I am, but I'd like to think not...

  25. #25
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Select Relevant Text till not exist. First Script.

    The formula the script is adding in is this formula in the BackOrder worksheet, column P:
    =IF(OR(B1="",D1=""),"",IF(COUNTIFS('Jobs List'!B:B,B1,'Jobs List'!D:D,D1),"","Different"))

    That formula combines the two formulas so that you don't have to use two columns, you only need to use one. No changes were made to the formulas on the Jobs List sheet.

    K.I.S.S. is always best practice, the simpler the better. I chose to put in that script manually because you said the BackOrder sheet gets its data from being imported from a program called FishBowl. If that's the case, that sheet probably changes regularly and there's no guarantee that a formula would stay in column P. As such, I added to the macro to input the formula manually to guarantee that it will always be present.

  26. #26
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Re: Select Relevant Text till not exist. First Script.

    Ahh, I see the confusion, I've actually made it so that when the import happens only thing that is replaced are columns A-N, no other columns change on the BackOrder tab.

  27. #27
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Re: Select Relevant Text till not exist. First Script.

    So I have to ask though, do I put the code in question after this? If I want to do it like you suggested the first time, since there is no worry about the data being lost?

    Please Login or Register  to view this content.
    Or do I need to start a new string of events?

  28. #28
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Select Relevant Text till not exist. First Script.

    You would need to put the code in before you perform the autofilter for "<>Different" so that the formula is in there for when you do the autofilter

  29. #29
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Re: Select Relevant Text till not exist. First Script.

    Quote Originally Posted by tigeravatar View Post
    You would need to put the code in before you perform the autofilter for "<>Different" so that the formula is in there for when you do the autofilter
    So after
    Please Login or Register  to view this content.
    and before this?

    Please Login or Register  to view this content.
    So it would look like this?:

    Please Login or Register  to view this content.
    Last edited by Cyberpawz; 03-23-2012 at 03:34 PM.

  30. #30
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Select Relevant Text till not exist. First Script.

    Almost. You should do the formula copy before copying wsB to Sheets.Add and you'll also have to define LastRow for wsB (otherwise it will use the last row for wsJ).

    So it should look something like this:
    Please Login or Register  to view this content.

    LastRow will get updated for wsJ later in the code, so no need to worry about that.

  31. #31
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Re: Select Relevant Text till not exist. First Script.

    Quote Originally Posted by tigeravatar View Post
    Almost. You should do the formula copy before copying wsB to Sheets.Add and you'll also have to define LastRow for wsB (otherwise it will use the last row for wsJ).

    So it should look something like this:
    Please Login or Register  to view this content.

    LastRow will get updated for wsJ later in the code, so no need to worry about that.
    With that entered, I am getting an error now:

    Please Login or Register  to view this content.
    When I press Debug, it points at:

    Please Login or Register  to view this content.
    I have to ask, why?

    BTW, the code prior to this works great, thanks for all your help.

  32. #32
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Select Relevant Text till not exist. First Script.

    Cyberpawz,

    I'd have to see the code to tell you why its giving an error. In general, a range object's .Parent is the worksheet that the range is on. If you're using .Parent without a range object, it will give that error. You'll notice in the pseudo-code I provided that the first With statement defines a range. The second with statement uses the same range's .Parent, or its worksheet.

  33. #33
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Re: Select Relevant Text till not exist. First Script.

    This was the last script I had that worked entirely. When I entered the code above into it, the error happens.

    Please Login or Register  to view this content.
    This is what I see when I entered the code you have...

    Please Login or Register  to view this content.

  34. #34
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Select Relevant Text till not exist. First Script.

    Cyberpawz,

    Found the issue. After copy/pasting the formula in the BackOrder worksheet, it wasn't calculating because my script turned calculation off to increase speed. I put in the keyword Calculate after copy/pasting the formula and then the macro worked fin. What was causing the error, was after it deleted all items without "Different" (which was everything because the formula hadn't calculated yet), there was no range object and thus no .Parent to use because everything had been deleted.

    This code ran successfully:
    Please Login or Register  to view this content.

  35. #35
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Re: Select Relevant Text till not exist. First Script.

    Just tried:

    Please Login or Register  to view this content.
    Same error...

  36. #36
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Select Relevant Text till not exist. First Script.

    Where are you storing the formulas for the BackOrders columns P and Q? The above code assumes that they're in P5 and Q5:
    Please Login or Register  to view this content.


    If that's not the case, update it from "P5:Q5" to the correct location.

  37. #37
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Re: Select Relevant Text till not exist. First Script.

    Nope, the code is there, there is nothing wrong on my end... I get an error with the With .Parent... also just curious, should it be With .Parent, or should it be With.Parent?

    Here is the sheet.

    http://dl.dropbox.com/u/3327208/Exce...List%20up.xlsm

  38. #38
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Select Relevant Text till not exist. First Script.

    Cyberpawz,

    I am unable to download the sheet you posted (I'm at work, and dropbox is blocked). If possible, please use the forum attachment feature. If the workbook is too big, create a dummy workbook.

    Attached is your previously attached workbook. It includes the most recent code I posted and it runs successfully. 'With' is a keyword, not an object, so you do want the space.
    Attached Files Attached Files

  39. #39
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Re: Select Relevant Text till not exist. First Script.

    That is weird, your script looks the same as mine... thanks again... I don't know why mine isn't working but my luck there is a space where none is meant to be somewhere.

  40. #40
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Re: Select Relevant Text till not exist. First Script.

    I hate to bring this in from the grave, but after using this for a day or two, I have noticed that the script isn't functioning like it is meant to. For some reason it is importing duplicates, and not ignoring them like before, and not organizing the rows via date... or moving the old ones to the Archive if there are any.

    Here is the latest version.

    This is the latest sheet, it shows from line 125 down duplicates of what was imported. Three times...

    Can you help please?
    Attached Files Attached Files
    Last edited by Cyberpawz; 04-02-2012 at 01:57 PM.

  41. #41
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Re: Select Relevant Text till not exist. First Script.

    Ok, solved it, mostly.

    Please Login or Register  to view this content.
    Now for some reason the code is copying what is required from BackOrder, except for one row in the lines I don't want imported after the first mass of code.

    Any idea after looking at this code, why?

  42. #42
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Re: Select Relevant Text till not exist. First Script.

    Here is the most up to date list. For some reason the BackOrder field is being copied over completely except how it was meant to be, which was only copy those over that are not duplicates, and the script is moving everything over to Archive from Jobs List, even though it is obviously not supposed to do so. If anyone can help me it be greatly appreciated.
    Attached Files Attached Files
    Last edited by Cyberpawz; 04-04-2012 at 12:50 PM.

  43. #43
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Select Relevant Text till not exist. First Script.

    Cyberpawz,

    From what I can tell, the problem is the formulas in 'Jobs List'!M3 and down and also the formula in 'Jobs List'!X1. Both are off by 1 column.

    'Jobs List'!M3 (and copied down) is:
    =COUNTIFS(BackOrder!A:A,A3,BackOrder!C:C,C3)

    But shouldn't is be...
    =COUNTIFS(BackOrder!B:B,B3,BackOrder!D:D,D3)


    Same for the formula in 'Jobs List'!X1. Move its columns from L and N to M and O

    When I made those changes, it worked fine for me using your most recent workbook.

  44. #44
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Re: Select Relevant Text till not exist. First Script.

    I noticed that too, I made the changes after a few more tweaks. Thanks, I was panicking because I couldn't figure out the script at first, and after reading it and dissecting it I ended up figuring it out 2 minutes before you commented. Although there is a question I do have... if you noticed in the Remarks field, when you add in new ones, is there a way to add in a border around it?

  45. #45
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Select Relevant Text till not exist. First Script.

    Cyberpawz,

    Near the end of the code are these 2 lines:
    Please Login or Register  to view this content.


    The first line copies M1:T1 of the 'Jobs List' worksheet. The second line paste specials -> formats. It sounds like you need to extend what it copies to include 2 more columns (M1:V1). Just be sure to move formulas over 2 columns from U, V, X, and Y, and change their copy/paste lines also.

  46. #46
    Forum Contributor
    Join Date
    11-11-2007
    Posts
    263

    Re: Select Relevant Text till not exist. First Script.

    This is the code now, I found a few mistakes...and fixed them, either it was an oversight on my side, or something of the sort, I'm not sure but it's working for now.

    I'll show the update I've done on the sheet.

    Please Login or Register  to view this content.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1