Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello There,
I want to find a text in a sheet and then I want to select all the data in that particular column. (note : In between the data blank cells are there.) Thanks & Regards, Sreenivas |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here is some code for you to try. This code looks for the Word "This"
anywhere on Sheet1 and selects all of the populated cells in that column... Sub SelectColumn() Dim rngFound As Range Dim rngToSearch As Range Dim rngFinal As Range Dim wks As Worksheet Set wks = Sheets("Sheet1") Set rngToSearch = wks.Cells Set rngFound = rngToSearch.Find(What:="This", _ LookIn:=xlFormulas, _ LookAt:=xlWhole, _ MatchCase:=False) If rngFound Is Nothing Then MsgBox "Sorry, Not found." Else Set rngToSearch = rngFound.EntireColumn Set rngFound = rngToSearch.SpecialCells(xlCellTypeFormulas) If Not rngFound Is Nothing Then Set rngFinal = rngFound End If Set rngFound = rngToSearch.SpecialCells(xlCellTypeConstants) If Not rngFound Is Nothing Then Set rngFinal = Union(rngFound, rngFinal) End If rngFinal.Select End If End Sub -- HTH... Jim Thomlinson "cheenu" wrote: Hello There, I want to find a text in a sheet and then I want to select all the data in that particular column. (note : In between the data blank cells are there.) Thanks & Regards, Sreenivas |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do you select all text/data within all the cells of a column? | Excel Discussion (Misc queries) | |||
Finding text in one column that compares to another | Excel Programming | |||
Finding data in a text column | Excel Discussion (Misc queries) | |||
Finding Duplicate text strings with a single column | Excel Worksheet Functions | |||
Macro query - finding mutliple occurences of text in a column | Excel Programming |