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

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,194
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

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
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,214,652
Messages
6,120,746
Members
448,989
Latest member
mariah3

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