View Single Post
  #1   Report Post  
Michael
 
Posts: n/a
Default Find the cell value in excel by using vb code

Hi.

I'm trying to write a vb code that find a Row and a Column in worksheet2
that i called PoF (headline)
It looks like this

Row/Column: a b c d e
1
2 PoF
3
4 6
5 6
6 8

The name is PoF because i will use the same code in different sheets and the
name PoF in different Columns/Rows

The code is a loop.

W = Worksheets(2).Range("PoF").Row
' This will give me the Row, but i also need to find the Column.

'Then a i also need the code to find the first cell that includes a number

Number = (Worksheets(2).Range("d4").Value) ' this will give me the value 6
in the example
'but i cant put "d4" etc in every code in every sheet, is there a code to
fix this?

numberRow = Worksheets(2).Range("First number").Row
'The cell that includes the first number??

for i=numberRow (as row number) to the end of row?? (to the last cell
number) step 1

If number = 6 then
w10="Ok"
ElsIf
w10="Try again"
end if

Next mumber

Next numberRow

Please help me!