![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Christchurch New Zealand
Posts: 1,030
|
how would I then select those whole rows and copy them?
Public Sub main() Dim sText As String Dim oRange As Range Dim oTargetRange As Range Dim sFirstRange As String Dim sSelect As String sText = "Tecpak two" Set oTargetRange = Sheets("Sheet1").UsedRange.Columns("A") Set oRange = oTargetRange.Find(what:=sText, lookat:=xlWhole) If Not oRange Is Nothing Then sFirstRange = oRange.Address Do If oRange.Value = sText Then sSelect = sSelect & "," & oRange.Address End If Set oRange = oTargetRange.FindNext(oRange) Loop While Not oRange Is Nothing And sFirstRange <> oRange.Address End If Sheets("Sheet1").Range(Right$(sSelect, Len(sSelect) - 1)).Select End Sub |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Columbus, OH, USA
Posts: 3,519
|
Add a line like this:
After the line with ".select" HTH |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|