Results 1 to 6 of 6

If Text Lenght > x then

Threaded View

  1. #1
    Forum Contributor
    Join Date
    12-19-2011
    Location
    Central Europe
    MS-Off Ver
    Excel O365
    Posts
    364

    If Text Lenght > x then

    Hi all

    I am trying to achieve that if the text lenth is greater than x do something

    So here's what I thoguth should work

    Sub test2()
    
    Dim lr As Integer
    Dim i As Integer
    Dim lngLen As Long
    lngLen = Len(strText)
    
    lr = ActiveCell.SpecialCells(xlLastCell).Row
    For i = 2 To lr
    
    With Range("d" & i)
    
    If Len(strText) > 6 Then .Value = "abc"
    
    End With
    Next i
    
    End Sub
    Could someone take a look at this code and tell me where I am going wrong?

    Thanks a lot

    FD
    Last edited by FallingDown; 04-29-2013 at 06:50 AM.

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