View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Bernard Liengme Bernard Liengme is offline
external usenet poster
 
Posts: 4,393
Default Select range higher than and lower than

Here is a very simple sub (there are more sophisticated ways)

Sub findthem()
Set myrange = Range("A1:A30")
mymin = 5999999
mymax = 6999999
j = 1
For Each myvalue In myrange
If myvalue mymin And myvalue < mymax Then
Cells(j, 7) = myvalue
j = j + 1
End If
Next
End Sub

I have assumed the numbers are in A1:A30; change the first statement as
needed.
I have placed the results in column G starting with G1; change j=1 to some
other value to start lower down and change the 7 in Cells(j,7) to use
another column.
Depending on your needs, you may want
If myvalue = mymin And myvalue =< mymax Then

best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Kasper" wrote in message
...
Hi

I need to write a macro that selects numers in a coloumn that are
higher than e.g. 5999999 but lower than 6999999 and copy them. Any
ideas?

The numbers are sorted according to value, so the lowest number is
first and the highest number is last in the coloumn.

Any help will be appreciated.

//Kasper