![]() |
If Cell.Value = [???] and <=[?????] Then
Adrian,
Try something like the following: Dim Rng As Range For Each Rng In Range("A1:A10") If Len(Rng.Text) =3 And Len(Rng.Text) <= 5 Then ' do something End If Next Rng Change A1:A10 to the appropriate range of cells. -- Cordially, Chip Pearson Microsoft MVP - Excel www.cpearson.com "Kobayashi" wrote in message ... I have tried to search the forum but haven't been able to find anything so please forgive me if this has been covered previously? How can I perform an If function, in a For... loop, whereby I wish to find all cells with a value ( and perhaps using value is wha'ts wrong?) between three and five characters (?) in length? Thanks once again, Adrian ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
If Cell.Value = [???] and <=[?????] Then
Chip/Tom,
Spot on! Many thanks to you both. I already had the Dim parts and the For...loop part sorted (clearly didn't make this clear in my post) I just needed to know what function to use and how to use it as I was formatting the If function as in the Subject of this message instead of how you both kindly advised: If Len(Cell.Value) = 3 And Len(Cell.Value)<=5 Again, I am very thankful to you both for your help and for the speed in which you replied. Many thanks once more! Adrian ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
All times are GMT +1. The time now is 09:09 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com