[Solved] How to write a macro that finds a cell based on length? [closed]


The following might help you. Assuming you have a single contiguous range of cells, some of which contain a 4 character code, you can do

Sub test()
Dim r As Range
Set r = Range("A1:A6")

For Each c In r.Cells
  If Len(c) = 4 Then
    Debug.Print "cell ", c.Address(), " had four characters: ", c.Value()
  End If
Next c
End Sub

When I run this on a spreadsheet where the first 6 cells in column A are

This
is
a
list
of
words

The output in the debug window is

cell $A$1 had four characters: this
cell $A$4 had four characters: list

This is for inspiration only, as your problem was really not very well described. Can you take it from here?

solved How to write a macro that finds a cell based on length? [closed]