Vba to tell me what cell in range has the most letters

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,210
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Everyone,
I'm trying to makea grid area where every cell is the same size,

I have 500 cells and keep finding when I resize some text in some cells is missing

is there a macro I could run that would tell me which cell has the longest amount of text?

Thanks

Tony
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Try:
Code:
Sub FindLength()
    Application.ScreenUpdating = False
    Dim rng As Range, cnt As Long, sAddr As String
    For Each rng In Range("[COLOR="#FF0000"]A1:J50[/COLOR]")
        If Len(rng) > cnt Then
            cnt = Len(rng)
            sAddr = rng.Address(0, 0)
        End If
    Next rng
    MsgBox ("The longest text is in cell " & sAddr)
    Application.ScreenUpdating = True
End Sub
Change the range (in red) to suit your needs.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,219
Members
452,619
Latest member
Shiv1198

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top