Posts by Laan

    Re: Sorting A Listview

    And if I may add, why is such event still in the list of events for the listview objects when it can't be used anyway? That's so strange for me.

    Thanks again.

    Re: Sorting A Listview

    That can be done but that will certainly need more codes.

    All I want is to be able to sort the listview depending on which ColumnHeader was clicked. I am really wondering why in VBA, I encounter this message "Use-defined type not defined" whenever I try to activate the ColumnClick Event while I haven't in VB.

    Is there no way to do it?

    Re: Sorting A Listview

    Ooopps my bad! Sorry, I wasnt very specific.

    I was actually talking about the listview object I put on a User Form.

    This would have been my code to sort the listviews depending on which columnheader was clicked but then I couldn't even 'access' the ColumnClick event of the listview:

    Private Sub ListView1_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader)
    With ListView1 
        Static iLast As Integer, iCur As Integer
        .Sorted = True
        iCur = ColumnHeader.Index - 1
        If iCur = iLast Then .SortOrder = IIf(.SortOrder = 1, 0, 1)
        .SortKey = iCur
        iLast = iCur
    End With
    End Sub

    I want to sort my listview but everytime I try to add a ColumnClick event, it always says, "Use-defined type not defined."

    Can someone tell me how to fix this? I want the contents of my listview sorted whenever I click a particular columnheader like I used to in VB.

    Thanks a lot.

    I put two(2) images/pictures and a "Delete" button in a worksheet. Then I selected the two images and clicked "Delete." Unfortunately, the images didnt get deleted. The "Delete" button contained the line "Selection.Delete." But when I tried to select the images and run the "Delete" button code from within the VBE, it ran perfectly and the images were deleted.

    I attached the file so that anyone who wishes to reply can see clearly what I want to accomplish.

    Can someone help me with this? Thanks.

    Thanks, Damo. Thanks Will. Yes, I agree with you, and personally, I would rather have it developed using Crystal Report :)

    Anyway, if ever they would want it developed using Excel - VBA, can you please help me how I can determine page breaks or new lines as the printer sees it, just in case?


    Anybody who have used Excel as a report generator? For a scenario, the user will have to input a date range and job order range. Excel will then create a header and a footer for the report, access sql database, and will only display job order per page [for printing purposes]. If there are 3 job order number in the range specified by the user, the sheet will then take at least 150 rows, and so on and so forth. In addition, the task will also have an option for the user on whether to print the report on screen, on file, or on printer.

    Is this feasible in Excel or should I recommend crystal report tool instead? This is the first time I am asked to create a pure report on Excel, and haven't learned about determining page breaks in excel.

    Thanks in advance!



    I am validating my data before proceding to my integration. When the Customer ID does not exist from my database, I am coloring it with red. Before the user clicks the button, I want to make sure that there is no red font record [meaning, no invalid Customer ID]. Is there an easier way to check my sheet for red font text aside from looping through the rows?

    Thanks in advance...
    Thank you very much :)

    Hi. I feel that this is a simple question but I cannot solve, please help me.

    I am integrating Excel with an application. When I begin integrating my VBA, I have to activate the application first to run the integration smoothly, its like playing a macro to the application so it has to be the active window. Then afterwards, I want to set the focus [activate] to Excel after the integration, meaning, I want my Excel to be the active window.

    I have tried the code below at the end:

    msgbox "Integration completed."

    I even tried to double the
    windows("myExcel.xls").activate, and/or
    sheet2.activate, and/or"myExcel.xls").activate,
    doevents, combined these codes but its still not activating my Excel application. Any suggestions?

    Thanks for all the help!

    I have a FindLastRow function that would search in the whole sheet for the last used cell:

    FindLastRow = ws.Cells.Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row

    Is it possible to lookup only in one particular column and return the row number of the last used cell for that particular column?
    Is there any available VBA help on MS Excel?
    Thanks for looking! And thank you in advance!



    I've tried the sumif formula after I have sorted the Column A ascending:
    But, this result to blank spaces in between the range and I want to delete that blanks so I can arrange the resulting data in consecutive rows. My concern is to arrange the results in consecutive rows. I just thought that someone might have an easier or shorter solution for this.

    Hi :)
    Col A Col B Col C
    Apple 2 10
    Banana 1 5
    Apple 1 2
    Grapes 3 5
    Orange 2 10
    Mango 5 15
    Apple 2 5
    Banana 1 3

    and make it into this:

    Col A Col B Col C
    Apple 5 17
    Banana 2 8
    Grapes 3 5
    Orange 2 10
    Mango 5 15

    You see, I get unique(column a), sum column b, and finally, get the sum of column c.

    Can anybody help me or redirect me to this topic.


    I have this simple question.

    I am importing my excel file into a table in SQL. I formatted my column for phone as text in my Excel file, but when I import it into SQL, SQL recognize it as numbers [float in the table properties]!

    I tried using copy & paste especial, clicking the "Format" option button but nothing changed. SQL still make it in float data type.

    How can I fix that? thanks.

    btw, sample data for my phone column is 123456789, 99967105

    thank you very much!