In the attachment, is there a way if I want to find the text which has broaden the column B, if I'm in cell B1 without going to downward or going to that specific text which has broaden column B
In the attachment, is there a way if I want to find the text which has broaden the column B, if I'm in cell B1 without going to downward or going to that specific text which has broaden column B
Try this one.
![]()
Sub tst() sn = Cells(1).CurrentRegion.Value For i = 1 To UBound(sn) currwidth = Len(sn(i, 1)) If currwidth > newwidth Then newwidth = currwidth: rnum = i End If Next MsgBox "The data you're looking for is on row " & rnum End Sub
Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.
This is also a good solution, but can we move directly to that cell
![]()
Sub tst() sn = Cells(1).CurrentRegion.Value For i = 1 To UBound(sn) currwidth = Len(sn(i, 1)) If currwidth > newwidth Then newwidth = currwidth: rnum = i End If Next Application.Goto Cells(rnum, 1), True End Sub
Thank you very much
You're welcome and thanks for rep+.![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks