Hi all. I have a question about finding cells in the active row. Basically, here is what I want to do:
Let's say the active row is 124 (C124 is selected). I would like to write a macro that determines the active row then looks at specific columns and determines the first non-zero row out of those specific columns.
For this example, we'll say the columns to be searched are B, F, H, Z, AE, and AF
So, the user selects row 124 and then runs the macro, here's what would happen:
The macro would first look at B124, then F124, then H124, then Z124, then AE124 then AF124, but would stop and select the first non-zero value. If no non-zero value is found, a msgbox pops up and say "no value found".
Thanks!
Last edited by touchofknowledge; 12-19-2011 at 05:27 PM.
Sub x() Dim cell As Range For Each cell In Rows(ActiveCell.Row).Range("B1, F1, H1, Z1, AF1") If cell.Value <> 0 Then cell.Select Exit Sub End If Next cell MsgBox "Not found" End Sub
Microsoft MVP - Excel
Entia non sunt multiplicanda sine necessitate
Hi shg. Works great! Thank you very much.
The samething i need but searching should be for a set of columns like "C" to "BG" and look for the cell which is having the value and the column "B" should have the vertical look up of row number 125.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks