Posts by norie

    Re: Number DIMs automatically


    That code just isn't right, mind you I'm not sure what it's meant to do.


    If the first part is meant to be naming ranges it should be like this.

    Code
    For Q = 1 To 4 
                 
       Worksheets("Sheet1").Range("B" & j).Name ="LIMIT " & Q   
       Worksheets("Sheet1").Range("C" & j).Name = "MTOPC" & Q  
       Worksheets("Sheet1").Range("E" & j).Name = "CYCLEC" & Q


    Note I've assumed Worksheets(Sheet1) is meant to refer to Sheet1, otherwise the code would fail unless you've declared a variable called Sheet1 somewhere else and given
    it a value that is the name of an existing worksheet.


    Not sure what's happening here, are ASSIGN1, ADDM1, CLOSING1, ASSIGN2, ADDM2, CLOSING2 etc existing named ranges


    Code
    Range("ASSIGN" & Q) = Range("CHECKSUM") 
    Range("ADDM" & Q) = Range("ADDM" & Q) + Range("ASSIGN" & Q) 
    Range("CLOSING" & Q) = Range("CLOSING" & Q) + Range("ASSIGN" & Q)


    Also, why are you naming individual cells?


    Why not name entire columns or rows of data?


    Or even name the entire range.

    Re: Number DIMs automatically


    You haven't used any variables in that code apart from Q.


    "LIMIT" & Q is just a string, and Range("LIMIT" & Q) is referring to a named range called LIMITQ, where Q is 1,2,3,4.

    Re: Number DIMs automatically


    Why have you declared a whole bunch of variables that you never use, and never need to use?


    I can remove all these declarations and the code will still compile.

    Re: Run-time error: 91 - Looping through ListBox to Copy/Paste Selected Items


    Change the loop to start at 0 and end at ListCount.

    Code
    For lItem = 1 To lb.ListCount


    You might also want to increment lastRowColD.

    Re: Array of Dates converting to String in Combobox Problem


    If you need to convert to a date you use DateValue, or CDate.


    You wouldn't need that for the combobox though, only when comparing the dates in the sort sub.


    Are you sure you can't attach a sample workbook?


    All it would need would be a worksheet with dates and the userform, nothing else.

    Re: Array of Dates converting to String in Combobox Problem


    Instead of using an array of dates use an array of strings that represent those dates.


    Then populate it using the cell's Text property so it's formatted as it's on the worksheet.


    You'll need to adjust the sorting sub to use DateValue to convert the items in the array to real dates so you can compare them chronologically.

    Re: On Error Resume Next Problem


    What you could do is get rid of the On Error ... and then you might find out what the problem is.:)


    Then you can decide what to do, perhaps dealing with the problem(s) with some of the methods you mention.

    Re: How to skip specific loops in a loop?


    William


    Are you really looping through the entire range A1:F100?


    If you just wanted to check column A for 'yes' and process B:F if it's found you could use something like this.

    Code
    For Each x In Range("A1:A100")
    
    
         If x.Value = "yes" Then
               ' process B:F on same row as x
         End If
    Next x


    This doesn't skip any iterations of the loop, it just doesn't do anything on every one of them.