New Collection add trim

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This works perfect but how would I add the following? Please Help.
How can I add if len(trim(cell)) <9521 then

Dim bkList As New Collection
With Workbooks("1DLSUNDAY.XLS").Worksheets("Master")
Set rng = .Range(.Cells(2, 3), .Cells(200, 3).End(xlDown))
End With

On Error Resume Next
For Each cell In rng
if len(trim(cell)) > 0 then
bkList.Add Trim(cell.Text), Trim(cell.Text)
end if
Next
On Error GoTo 0

For Each itm In bkList
Workbooks.Open "C:\Documents and Settings\Tom\Desktop\CHARTER BLANK\NEW
BLANK\" & _
itm & ".xls"
Next
 
ok i guess you are not loooking for the length of the cell text to be less
than 9521 but for its value to be less than 9521:

if len(trim(cell)) > 0 AND val(trim(cell)) <9521 AND val(trim(cell)) >0
Then

- the first part of the condition makes sure there is some non-blank text in
the cell: LEngth >0
- the two following conditions make sur the Value is greater than 0 and less
than 9521.
 
Thanks that fixed it.

sebastienm said:
ok i guess you are not loooking for the length of the cell text to be less
than 9521 but for its value to be less than 9521:

if len(trim(cell)) > 0 AND val(trim(cell)) <9521 AND val(trim(cell)) >0
Then

- the first part of the condition makes sure there is some non-blank text in
the cell: LEngth >0
- the two following conditions make sur the Value is greater than 0 and less
than 9521.
 
Back
Top