View Single Post
  #1   Report Post  
Michael
 
Posts: n/a
Default Find a empty cell in next column

hi.
Dave helped me with this before, now i need more help.

I use this code to find a column called PoF and the numbers written in the
cells below it. This code work in every row/column (i dont need to name it).

PoFRow = 0
PoFCol = 0
On Error Resume Next
PoFRow = Worksheets(2).Range("PoF").Row
PoFCol = Worksheets(2).Range("PoF").Column

On Error GoTo 0

If PoFRow = 0 Then
MsgBox "No range named PoF on worksheet:" ' & .Name '
Else
Set numberPoF = Nothing
On Error Resume Next
Set numberPoF = Worksheets(2).Range(Worksheets(2).Cells(PoFRow + 1, PoFCol),
Worksheets(2).Cells(Worksheets(2).Rows.Count,
PoFCol)).Cells.Cells.SpecialCells(xlCellTypeConsta nts, xlNumbers).Cells(1)

On Error GoTo 0 'Ved error går den til 0
yPoF = numberPoF.Address(Row)
End If

Lets say that the code will find the name PoF in Column X, Row 4 and the
first number below it in column X, Row 7.

If PoF is in Column X, Column Y has the name Risk (it is always the next
column).

Column y (Risk) is always empty before i have tested column x,a,b etc etc in
the same worksheet. When the code has tested everything i want the code to
return the value L, HM, M, N etc into column Risk, starting in the same cell
that the number was found in PoF. Like this


Row/Column X Y Z
3
4 PoF Risk
5
6
7 5 N
8
9



Nil Satis Nisi Optimum