Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 434
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Average Formula to display blank cell if named range is blank Rachael F Excel Worksheet Functions 3 February 22nd 08 05:05 PM
Start Cell B1 then find first blank cell, insert subtotal, next non blank, then next blank, sutotal cells in between......... [email protected][_2_] Excel Programming 2 June 7th 07 09:27 PM
Need macro to check if cell is not blank & previous cell is blank, copy information from row above & paste JenIT Excel Programming 4 April 12th 07 08:56 PM
Copy to first Blank cell in Colum C Non blank cells still exist be Ulrik loves horses Excel Programming 2 October 8th 06 07:35 PM
COPY A CONCATENATE CELL TO BLANK CELL PUTTING IN THE NEXT BLANK C. QUEST41067 Excel Discussion (Misc queries) 1 January 15th 05 09:29 PM


All times are GMT +1. The time now is 11:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"