Searching for text in cells

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to search a group of cells for text and return that text into one
cell. There will always be only one value in that group of cells.
 
Sub GetText
Dim rng as Range, sStr as String
On Error Resume Next
set rng = Selection.SpecialCells(xlConstants,xlTextValues)
On Error goto 0
if not rng is nothing then
for each cell in rng
sStr = sStr & cell.Value
next
Range("A1").Value = sStr
End if
End sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top