Remember Me?

 Michael Posts: n/a 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
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

 Dave Peterson Posts: n/a But you didn't share how to determine what to put in that adjacent column.

What makes you use: L, HM, M, N etc?

If you just want to plop something into that cell just to the right of the
numberPoF:

numberPof.offset(0,1).value = "whatever you want here"

Michael wrote:

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
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

--

Dave Peterson
 Michael Posts: n/a Thanks again Dave.

I will try this.

I just want to put L, HM, N etc in the next column but in the same row
number. It is a loop like this

If PoF = 5 and 2<= CoF= 4 then

(and CoF is column x and the row is 10, the code should put L, N etc into
column y row 10)

Else if
PoF = 4 and CoF=4 then

''''numberPof.offset(0,1).value = "whatever you want here" (your formula)

end if
--
Nil Satis Nisi Optimum

I think this will work. Thanks again.

As you found out "Nothing but the best is good enough" :-)

"Dave Peterson" wrote:

But you didn't share how to determine what to put in that adjacent column.

What makes you use: L, HM, M, N etc?

If you just want to plop something into that cell just to the right of the
numberPoF:

numberPof.offset(0,1).value = "whatever you want here"

Michael wrote:

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
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

--

Dave Peterson

 Dave Peterson Posts: n/a If PoF = 5 and 2<= CoF= 4 then

Did you really mean Cof =2 and CoF = 4? (It looks like a typo and you want it
trapped between 2 and 4.

If yes, then maybe:

if pof = 5 and cof =2 and cof <= 4 then

Michael wrote:

Thanks again Dave.

I will try this.

I just want to put L, HM, N etc in the next column but in the same row
number. It is a loop like this

If PoF = 5 and 2<= CoF= 4 then

(and CoF is column x and the row is 10, the code should put L, N etc into
column y row 10)

Else if
PoF = 4 and CoF=4 then

''''numberPof.offset(0,1).value = "whatever you want here" (your formula)

end if
--
Nil Satis Nisi Optimum

I think this will work. Thanks again.

As you found out "Nothing but the best is good enough" :-)

"Dave Peterson" wrote:

But you didn't share how to determine what to put in that adjacent column.

What makes you use: L, HM, M, N etc?

If you just want to plop something into that cell just to the right of the
numberPoF:

numberPof.offset(0,1).value = "whatever you want here"

Michael wrote:

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
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

--

Dave Peterson

--

Dave Peterson

 Thread Tools Search this Thread Show Printable Version Search this Thread: Advanced Search Display Modes Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Posting Rules Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Similar Threads Thread Thread Starter Forum Replies Last Post Mr. Snrub Excel Discussion (Misc queries) 4 May 30th 05 12:53 PM kevinm Excel Worksheet Functions 21 May 19th 05 11:07 AM Nigel Bennett Setting up and Configuration of Excel 2 April 29th 05 08:03 PM Alma Excel Worksheet Functions 2 March 22nd 05 06:19 PM Biff Excel Worksheet Functions 2 November 24th 04 07:16 PM

All times are GMT +1. The time now is 09:05 PM. Copyright ©2004-2020 ExcelBanter.