Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
first non blank cell
Hello, on clue on how to find first non blank cell in the columns selected.
For example; if user selects Column A and Column B I need to find first non blank cell only in the column A and B. thanks. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
first non blank cell
Hi guest
Try this Sub test() On Error GoTo BodemUp Columns("A:B").Cells.SpecialCells(xlCellTypeBlanks ).Cells(1).Select Exit Sub BodemUp: Cells(Rows.Count, "A").End(xlUp)(2).Select End Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "guest" wrote in message ... Hello, on clue on how to find first non blank cell in the columns selected. For example; if user selects Column A and Column B I need to find first non blank cell only in the column A and B. thanks. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
first non blank cell
hi, !
... on clue on how to find first non blank cell in the columns selected. For example; if user selects Column A and Column B I need to find first non blank cell only in the column A and B. for the first non blank cell in selected range... maybe something like... On Error GoTo EmptyRange With Selection ' Columns("a:b") .Find("*", .Cells(.Rows.Count, .Columns.Count), xlValues, xlWhole, xlByRows).Select Exit Sub EmptyRange: MsgBox "It's an empty range !": .Cells(1).Select End With hth, hector. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
first non blank cell
Not sure what you mean by "find"... this code will create a selection
composed of the first blank cell in each column of the original selection (this original selection does not have to be the whole columns... you can simply one or more cells in each column before running the code). Dim C As Range Dim Result As Range For Each C In Selection.Columns If Result Is Nothing Then Set Result = C.Offset(1 - C.Row, 0).End(xlDown) Else Set Result = Union(Result, C.Offset(1 - C.Row, 0).End(xlDown)) End If Next Result.Offset(1, 0).Select If you need to do something other than select the cells, the Result.Offset(1, 0) range will contain all first blank cells in each column... simply do something else besides selecting them. Rick "guest" wrote in message ... Hello, on clue on how to find first non blank cell in the columns selected. For example; if user selects Column A and Column B I need to find first non blank cell only in the column A and B. thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Average Formula to display blank cell if named range is blank | Excel Worksheet Functions | |||
Start Cell B1 then find first blank cell, insert subtotal, next non blank, then next blank, sutotal cells in between......... | Excel Programming | |||
Need macro to check if cell is not blank & previous cell is blank, copy information from row above & paste | Excel Programming | |||
Copy to first Blank cell in Colum C Non blank cells still exist be | Excel Programming | |||
COPY A CONCATENATE CELL TO BLANK CELL PUTTING IN THE NEXT BLANK C. | Excel Discussion (Misc queries) |