Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi
I need some help programming a macro that can select the first cell in a row that is less than 8000(8000). Is it possible to do this via the Cells.find command? |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() Hi Kasper Add this to a module Sub FindCell() Dim cell As Range For Each cell In Range("A1:K1") If cell.Value < 8000 Then cell.Select Exit Sub End If Next End Sub HTH - Trevor Williams "Kasper" wrote: Hi I need some help programming a macro that can select the first cell in a row that is less than 8000(8000). Is it possible to do this via the Cells.find command? |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi,
thank you for your swift answer. Do you know if the number(8000) can be replaced by a variable, eg. cell E8 so the number which it enters is linked to the number i cell E8? |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Yes it can - use this...
Sub FindCell() Dim cell As Range myValue = Range("E8").value For Each cell In Range("A1:K1") If cell.Value < myValue Then cell.Select Exit Sub End If Next End Sub Trevor "Kasper" wrote: Hi, thank you for your swift answer. Do you know if the number(8000) can be replaced by a variable, eg. cell E8 so the number which it enters is linked to the number i cell E8? |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thank you
This works perfectly... If I later on in the formula change the value(myValue) and then repeat (loop) the process, will it then use the original value or use the new value? //Kasper |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi Kasper
myValue will always be what's in cell E8, so if you run it once with 8000 in cell E8 it will look for values <8000 - if you then change the value in cell E8 to 2000 and re-run it, it will look for values <2000. Have fun! Trevor "Kasper" wrote: Thank you This works perfectly... If I later on in the formula change the value(myValue) and then repeat (loop) the process, will it then use the original value or use the new value? //Kasper |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how do i find what cells equal a certain number? | Excel Discussion (Misc queries) | |||
find all combinations of cells that add up to certain number | Excel Worksheet Functions | |||
find all combinations of cells that add up to certain number | Excel Discussion (Misc queries) | |||
Find cells containing a specified number of characters | Excel Discussion (Misc queries) | |||
Find all cells with a number and mulitply | Excel Discussion (Misc queries) |