Posts by ivanian

    Hello Ozgrid!


    How are you all today?


    So we have this rows of data that we are extracting from a system and equally distributing to a team of 8 to work on for the day. The number of rows varies each day as well as the sequence of who takes the first set, second set, third set of data and so on. I also have to take into consideration the off days of the team members and if someone is to call-in sick.


    The process goes like this. [TABLE="border: 1, cellpadding: 1, cellspacing: 0"]

    [tr]


    [TD="width: 64"]Day1[/TD]
    [TD="width: 64"]Day2[/TD]
    [TD="width: 64"]Day3[/TD]
    [TD="width: 64"]Day4[/TD]
    [TD="width: 64"]Day5[/TD]

    [/tr]


    [tr]


    [td]

    Member1

    [/td]


    [td]

    Member8

    [/td]


    [td]

    Member7

    [/td]


    [td]

    Member6

    [/td]


    [td]

    Member5

    [/td]


    [/tr]


    [tr]


    [td]

    Member2

    [/td]


    [td]

    Member1

    [/td]


    [td]

    Member8 ( off day )

    [/td]


    [td]

    Member7

    [/td]


    [td]

    Member6

    [/td]


    [/tr]


    [tr]


    [td]

    Member3

    [/td]


    [td]

    Member2

    [/td]


    [td]

    Member1

    [/td]


    [td]

    Member8

    [/td]


    [td]

    Member7

    [/td]


    [/tr]


    [tr]


    [td]

    Member4

    [/td]


    [td]

    Member3

    [/td]


    [td]

    Member2

    [/td]


    [td]

    Member1

    [/td]


    [td]

    Member8

    [/td]


    [/tr]


    [tr]


    [td]

    Member5

    [/td]


    [td]

    Member4

    [/td]


    [td]

    Member3

    [/td]


    [td]

    Member2

    [/td]


    [td]

    Member1

    [/td]


    [/tr]


    [tr]


    [td]

    Member6

    [/td]


    [td]

    Member5

    [/td]


    [td]

    Member4

    [/td]


    [td]

    Member3

    [/td]


    [td]

    Member2

    [/td]


    [/tr]


    [tr]


    [td]

    Member7

    [/td]


    [td]

    Member6

    [/td]


    [td]

    Member5

    [/td]


    [td]

    Member4

    [/td]


    [td]

    Member3

    [/td]


    [/tr]


    [tr]


    [td]

    Member8

    [/td]


    [td]

    Member7

    [/td]


    [td]

    Member6

    [/td]


    [td]

    Member5

    [/td]


    [td]

    Member4

    [/td]


    [/tr]


    [/TABLE]


    Day1 = 1000 rows of data (excluding header) → (1000 - (1000 Mod 8) / 8 = 125 each
    Member1 gets the first 1st to 125th row, Member2 gets 126th to 250th row ........... Member 8th gets the last set of data that is 876th to 1000th.


    Day2 = 800 rows of data (excluding header) → (800 - (800 Mod 8) / 8 = 100 each
    Now Member8 gets the first set, Member1 gets the second set ......... Member7 gets the last set.


    Day3 = 1200 rows of data (excluding header) → (1200 - (1200 Mod 7) / 7 = 171 each and the remaining 3 will be added to the last set. So Member6 gets a total of 174.
    Member 7 gets the first set, Member1 gets the 2nd set ( since Member8 is not working this day ) .......... Member6 gets the last set.


    and the cycle goes on ( as shown in the table above ). Basically, the set of data is being rotated each day.


    Any idea how to implement the above in simple but efficient and bulletproof way?


    I'm thinking of a UserForm of Checkboxes with the names of each member. Checkbox of the respective member will be ticked if it's their working day by default. From there, the program will count the how many members are present and will divide the data accordingly. I know I said simple but the checkbox idea came to mind because of the OpenFile dialog that will prompt the user for the raw data that's extracted from the system which will then remove unnecessary data columns and row before distributing it to the team. That being said, I'm having trouble thinking of a way to implement the idea. Any help and suggestion will be much appreciated.


    PS: I hope what I said above makes sense :D
    [ATTACH=JSON]{"alt":"Click image for larger version Name:\tCapture.PNG Views:\t1 Size:\t15.0 KB ID:\t1200703","data-align":"none","data-attachmentid":"1200703","data-size":"full","title":"Sample Form"}[/ATTACH]

    Hello guys!


    I've been trying to work on a macro that will extract columns and rows of data with a given criteria from a master file and so far I have only managed to get the columns that I need by looping through the header row and copying the entire column and appending it in a table to another sheet. As for the rows, I managed to copy to certain rows with advancefilter copy but with only one criteria. What I need to to do is extract rows that meets multiple criteria. Say for example, in Col1, I need the row that has reqval1 or reqval2 that is not xx1 in either col2 or 3. So for the sample date below, the only rows that I need are, row2, row4 and row6. Can anyone tell me the most efficient way to do what I need please? Hopefully, what I;m trying to do makes sense. Thanks all!
    [TABLE="align: left, border: 0, cellpadding: 1, width: 500"]

    [tr]


    [td]

    Col1

    [/td]


    [td]

    Col2

    [/td]


    [td]

    Col3

    [/td]


    [td]

    Col4

    [/td]


    [td]

    Col5

    [/td]


    [/tr]


    [tr]


    [td]

    ReqVal1

    [/td]


    [td]

    RndVal

    [/td]


    [td]

    xx1

    [/td]


    [td]

    RndVal

    [/td]


    [td]

    RndVal

    [/td]


    [/tr]


    [tr]


    [td]

    ReqVal2

    [/td]


    [td]

    RndVal

    [/td]


    [td]

    RndVal

    [/td]


    [td]

    RndVal

    [/td]


    [td]

    RndVal

    [/td]


    [/tr]


    [tr]


    [td]

    RndVal

    [/td]


    [td]

    xx1

    [/td]


    [td]

    RndVal

    [/td]


    [td]

    RndVal

    [/td]


    [td]

    RndVal

    [/td]


    [/tr]


    [tr]


    [td]

    RndVal

    [/td]


    [td]

    xx2

    [/td]


    [td]

    RndVal

    [/td]


    [td]

    RndVal

    [/td]


    [td]

    RndVal

    [/td]


    [/tr]


    [tr]


    [td]

    ReqVal1

    [/td]


    [td]

    RndVal

    [/td]


    [td]

    RndVal

    [/td]


    [td]

    RndVal

    [/td]


    [td]

    RndVal

    [/td]


    [/tr]


    [tr]


    [td]

    ReqVal2

    [/td]


    [td]

    RndVal

    [/td]


    [td]

    xx1

    [/td]


    [td]

    RndVal

    [/td]


    [td]

    RndVal

    [/td]


    [/tr]


    [tr]


    [td]

    ReqVal1

    [/td]


    [td]

    RndVal

    [/td]


    [td]

    RndVal

    [/td]


    [td]

    RndVal

    [/td]


    [td]

    RndVal

    [/td]


    [/tr]


    [/TABLE]

    Hello,


    I'm trying to use Index Match as a VBA code while using a table as a my lookup array. I have no problem using it in excel formula but I can't my way around when converting to VBA code.


    this is the code that I'm trying to use but I'm getting an 'Object doesn't support' error

    Code
    Set myTbl = ThisWorkbook.Worksheets(ptSource).ListObjects(ptSource)
        Set vouchers = ThisWorkbook.Worksheets(1).ListColumn(1)
        Set invoiceNo = ThisWorkbook.Worksheets(1).ListColumn(2)
        
        With Application.WorksheetFunction
             MsgBox .Index(vouchers, .Match(myLookUp, invoiceNo, 0))
        End With


    I'm basically using the table columns as my lookup range. I hope that my question and what I'm trying to do makes sense.


    Thanks all.

    Re: Add same change event to multiple ComboBoxes


    I'm actually getting a Mismatch type after I implemented it to the original form that I'm working with. Probably because of the other controls like TextBox and ListBox. I tried to removed them and it executed without a problem. I'm looking into putting the other controls inside a Frame as a workaround but it would be nice if I could get it to work without having to resort to Frames.


    EDIT: Putting the other controls inside a Frame does not fix the problem. As soon as the I click inside the Frame the 'Mismatch' will trigger.

    Re: Add same change event to multiple ComboBoxes


    Quote from pike;769761

    you picked a doozie to start with


    I've been reading books in between. Just trying to squeeze-in whenever work doesn't ask too much of my time.


    Again, thanks for the help. I'd like to mark this SOLVED but it seems that there's no option to edit the thread title.

    Re: Add same change event to multiple ComboBoxes


    Quote from pike;769758

    This is the way to go with on enter control class . workbook attached


    classes of this level are very hard to grasp as there are lots of very rare methodologies used


    Thanks Pike. Yeah, I saw the code earlier and there are lots of methods that I'm not familiar (not surprising though as I'm still new to VBA Excel). Nevertheless, there is never a bad code to learn.


    Thank you for this.

    Re: Add same change event to multiple ComboBoxes


    Quote from pike;769753

    change event is triggered when there is a change in the combobox .. there is no change as its empty .. fill the comboxboxes and change the value .. it will trigger
    but one of the guns will know why


    Actually I tried it too. I added a loop to fill the combobox in UserForm module . But still won't trigger the Function FillList when combobox is changed.

    Re: Add same change event to multiple ComboBoxes


    Quote from pike;769747


    Thanks Pike. This would a nice resource for me. I found mine here in Ozgrid too. It was originally for TextBoxes and I just modified it a bit and change the controls to ComboBoxes.


    But I can't seem to make the Function FillList to run.


    Here's the link . http://www.ozgrid.com/forum/showthread.php?t=80631

    Re: Add same change event to multiple ComboBoxes


    Hello Pike,


    Exactly what I needed. Thank you so much. Is there a thread where the code came from? I am hoping that I could study the code so I could understand it well.


    And another thing. Do you happen to know what could be the problem with the code below? The change event won't execute. It's a class that I found online thatI modified a bit.


    'clsObjHandler' Class


    UserForm1 Module


    I hope you don't mind. Just trying to learn as much as I can.


    Thanks in advance.

    Following my previous post, I have managed to make a Function that populates multiple comboboxes from a same source and remove items that already exist in other ComboBoxes. Now my problem is I have to call the Function to each comboboxes which makes it redundant. I'm looking into firing the same change event to multiple comboboxes at once.


    This is what my code looks like so far.



    I've seen some approach using Collections but I can't seem to figure it out as to how should I apply the same method that suits my needs.


    Any help is greatly appreciated.


    Thanks and regards,

    Re: Userfrom Controls resizing on its own.


    Quote from pike;769582

    oh update button .... it a pain with just a photo .. move the update to the multipage and increase the fixedtabheight property of the multipage tabs to cover the gap


    Hello Pike,


    Thanks for your reply, sorry I forgot to mention that the first photo was opened from a unit with a lower resolution than the second photo which was opened with a higher resolution unit.


    Nevertheless, I will implement the property that you mentioned above.


    Thanks.

    Hello all,


    Just want to ask if there's anyway to avoid the userform controls resizing on its own? As you can see in the first picture, the form is displaying the controls the way it should be, but in the second picture. The 'Ring' tab and 'Update' button is overlapping each other.


    [ATTACH=CONFIG]68915[/ATTACH]
    [ATTACH=CONFIG]68914[/ATTACH]


    Hopefully, there's a fix on this. I've tried searching it off the internet and there are articles about ActiveX being quirky when placed in a Worksheet but I haven't seen one inside a userform.

    Re: Change label if string contains a ComboBox Value


    Hello Skywriter, you really are a life saver. That's exactly what I needed. Thank you so much.


    I could've sworn that I tried that too but for some reason the Captions stays blank.


    I did a little modification because I realized that I'll be adding more columns in the future and decided to store it in multidimensional array, now I'm back where I started. Could you please take a look which part am I missing? Thanks in advance


    So I have a label that will depend on the value of ComboBox. If the Value of ComboBox contains a specific string then it'll execute a Match Index from the range that I specified.
    I managed to do what I wanted but the problem now is I want to clear the label if the ComboBox does not contain the string that I'm looking for. I tried to add an 'ElseIf' then put the caption to blank but after doing so, if I changed that value of ComboBox it will stay as blank.



    Anyone please?


    Thanks in advance,

    Re: Run macro only if condition is met.


    Have you tried 'Isempty'?


    I don't use pivot but you can try something like this.


    Code
    Dim pvt As PivotTable
    Set pvt = ActiveSheet.PivotTables("Tabela przestawna2")
    
    
    If Not IsEmpty(pvt) Then
       RunThemAll
    End If