LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 48
Default Select range higher than and lower than

On 23 Okt., 13:11, Kasper wrote:
On 23 Okt., 12:50, Kasper wrote:





On 22 Okt., 16:19, "Bernard Liengme"
wrote:


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 MVPhttp://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
higherthane.g. 5999999 but lowerthan6999999 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- Skjul tekst i anførselstegn -


- Vis tekst i anførselstegn -


Thanks for the answer... I need the macro to select the complete row
for each of the values in the coloumn that is in the selected range
and then make it copy it to another sheet(that part is not too
difficult though)


//Kasper- Skjul tekst i anførselstegn -


- Vis tekst i anførselstegn -


But as I mentioned before, I need to get the macro to select e.g. Row
820 to Row 840(since these rows contain contain "myvalue" in coloumn
D) and then copy Everything in Row 820 to Row 840.
Any further help will be appreciated.

//Kasper- Skjul tekst i anførselstegn -

- Vis tekst i anførselstegn -


Okay, figured it out with this Macro. But the Activsheets.PAste
command doesn't work with it:

Sub findceller_dataark()



Range("A1:F2067").Sort Key1:=Range("D2"), Order1:=xlAscending,
Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal



Range("D2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.TextToColumns Destination:=Range("D2"),
DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 9), Array(4, 1)),
TrailingMinusNumbers:=True

Range("D1").Select
Selection.AutoFilter Field:=4, Criteria1:="<800000",
Operator:=xlAnd, _
Criteria2:="699999"
Selection.End(xlToLeft).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Sheets("Ark2").Select
Range("A1").Select


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can change range to select active rows instead of :=Range("S10 ldiaz Excel Discussion (Misc queries) 7 August 29th 08 03:52 PM
When entering data into a range of cells, select the entire range. Q Excel Discussion (Misc queries) 0 September 26th 07 04:36 AM
Can I flag numbers that are higher/lower than a range of #'s Rick Parker Excel Worksheet Functions 1 July 8th 06 01:56 AM
need to select closest match using vlookup if it higher or lower vlookup help pls Excel Discussion (Misc queries) 1 March 1st 06 07:30 PM
How can I find the row nr of the first number lower/ higher then a vmv Excel Discussion (Misc queries) 3 February 9th 05 02:03 AM


All times are GMT +1. The time now is 09:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"