View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Vergel Adriano Vergel Adriano is offline
external usenet poster
 
Posts: 857
Default Macro to select a list of values greater than or equal to a value

will copy values =100 in column A and paste in column B.

Sub test()
Dim rng As Range
Dim c As Range
Dim rngCopy As Range

With ActiveSheet
Set rng = .Range(.Range("A1"), .Range("A65535").End(xlUp))
End With
For Each c In rng
If c.Value = 100 Then
If rngCopy Is Nothing Then
Set rngCopy = c
Else
Set rngCopy = Union(rngCopy, c)
End If
End If
Next c
If Not rngCopy Is Nothing Then
rngCopy.Copy ActiveSheet.Range("B1")
End If

End Sub


--
Hope that helps.

Vergel Adriano


"DOOGIE" wrote:

I am trying to write a macro that will search through a list of values (this
list will vary in size) for all values greater than or equal to a specific
value (say =100). I want to activate all the cells containing those values
and copy them to another location. Can anyone help with this?