get all text value from sheet

CsJHUN

Active Member
Joined
Jan 13, 2015
Messages
360
Office Version
  1. 365
  2. 2021
  3. 2019
Platform
  1. Windows
  2. Mobile
Hi!

I would like to get all text value on a worksheet into one variable.
I managed with cells, its obvious.
Code:
...
Sheets(Sheets.Count).Select
For Each cell In Range("A11:EE500")
t = t & " " & LCase(cell.Value)
Next cell...

But stucked with other object which should have text value. So far i managed something like this will do, but...
Code:
For Each obj In Worksheets(Sheets.Count).OLEObjects
??????
next obj
Any help/advice is welcome :)
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
What is your motive behind concatenating large set of cells assigning into one variable ?
 
Upvote 0
I would like to search multiple short string within this variable, and i think this is faster than searching for these string the sheet over and over again.


So far the macro snipet:
Code:
Sheets(Sheets.Count).Select
For Each cell In Range("A11:EE500")
t = t & " " & LCase(cell.Value)
Next cell
t = LCase(t) 'had do multiple lcase because some characters not changed to lower case (multiple character coding: japanese chars with latin and cirill)
'______________from this the instr search multipled
For elsokar = 0 To Len(t)
elsokar = InStr(elsokar + 1, t, "hmn")
On Error GoTo exithmn
tn = Mid(t, elsokar, 11) & "; " & tn
Next
Exit Sub
exithmn:
'_____________ until this

Basically i need every searched text separated with "; " to make some kind of index/appendix/link/bookmark/footnote thingy
 
Upvote 0
So i think i figured it out

Code:
....there is more before that
For Each shp In Worksheets(Sheets.Count).Shapes
    On Error Resume Next
    g = shp.GroupItems.Count
        If g > 1 Then
            For i = 1 To g
                szoveg = ActiveSheet.Shapes(shp.Name).GroupItems(i).DrawingObject.Text
                If Len(szoveg) > 5 Then a = a & "; " & szoveg
                Next i
        Else
            szoveg = ActiveSheet.Shapes(shp.Name).DrawingObject.Text
            If Err.Number = 438 Then GoTo nextshape
            If Len(szoveg) > 5 Then a = a & "; " & szoveg
        End If
nextshape:
    On Error GoTo -1
    g = 0
Next shp
...code continues here

For first i tried to ungroup the grouped shapes than read the text but i happier with this solution.
 
Upvote 0

Forum statistics

Threads
1,214,560
Messages
6,120,222
Members
448,951
Latest member
jennlynn

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