René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

Selecting rows [Excel macro]

' select all Rows whose 'H' column is not '***'
sub select_rows()

  dim col As Long
  dim row As Long
  
  dim rngAll As excel.range
  
  col = 8 ' H
 
  for row = 2 To 30
    if application.cells(row, col).Value <> "***" then
  
       dim rngRow As excel.range
       
       set rngRow = excel.range(row & ":" & row)
       
       if rngAll is nothing then
          Set rngAll = rngRow
       else
          Set rngAll = excel.union(rngAll, rngRow)
     end if
    
    end if
   
  next row
  
  if Not rngAll Is Nothing then
    rngAll.select
  end if

end sub