Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Searching for "not blank"

I have a bit of code that searches a range object for the first blank cell:

Dim jswCell As Range

Range("B1:B280").Select
Set jswCell = Selection.Find(Empty)
Debug.Print jswCell.Row & "," & jswCell.Column

Once this is found, I would like it to start seraching from this blank cell,
continue down the column, and find the first "not blank" cell, regardless of
the value stored in that cell.

I have tried different ways of telling the .Find method to find the next
cell with a value, but everything I try gives errors. For instance,

Set jswCell = Selection.Find(Not Empty)

....will not find a "Not Empty" value. How should I code this?

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Searching for "not blank"

can you use something like this:-

Selection.End(xlDown).Select

which is the ctrl+down arrow ??

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Searching for "not blank"

Range("B1:B280").Select
Set jswCell = Selection.Find(Empty, After:=Range("B280"))
set rng = jswCell.End(xldown)
if rng.Row <= 280 then
rng.select
else
msgbox "Out of bounds"
end if


Building from Donna's suggestion
--
Regards,
Tom Ogilvy


wrote in message
oups.com...
can you use something like this:-

Selection.End(xlDown).Select

which is the ctrl+down arrow ??



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default Searching for "not blank"


"Joel" wrote in message
...
I have a bit of code that searches a range object for the first blank

cell:

Dim jswCell As Range

Range("B1:B280").Select
Set jswCell = Selection.Find(Empty)
Debug.Print jswCell.Row & "," & jswCell.Column

Once this is found, I would like it to start seraching from this blank

cell,
continue down the column, and find the first "not blank" cell, regardless

of
the value stored in that cell.

I have tried different ways of telling the .Find method to find the next
cell with a value, but everything I try gives errors. For instance,

Set jswCell = Selection.Find(Not Empty)

...will not find a "Not Empty" value. How should I code this?

Thanks!


Nice shortcut!
Any idea how to loop it?
Trying to improve/replace the following block which works....slowly.

For rowindex = finalrow To 1 Step -1
Select Case UCase$(Trim$(Cells(rowindex, 3).Value))
Case isblank: Rows(rowindex).Delete 'remove blanks and totals
Case "BILL": Rows(rowindex).Delete 'remove bills
Case "BILL PMT -CHECK"
If Cells(rowindex, 2).Value = "2000 · Accounts Payable" Then
Rows(rowindex).Delete
Case "DEPOSIT": Cells(rowindex, 8).Value = "DEPOSIT"
End Select
Next



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default Searching for "not blank"


"Joel" wrote in message
...
I have a bit of code that searches a range object for the first blank

cell:

Dim jswCell As Range

Range("B1:B280").Select
Set jswCell = Selection.Find(Empty)
Debug.Print jswCell.Row & "," & jswCell.Column

Once this is found, I would like it to start seraching from this blank

cell,
continue down the column, and find the first "not blank" cell, regardless

of
the value stored in that cell.

I have tried different ways of telling the .Find method to find the next
cell with a value, but everything I try gives errors. For instance,

Set jswCell = Selection.Find(Not Empty)

...will not find a "Not Empty" value. How should I code this?

Thanks!


try: (cursor should end up in the first cell containing data after the
first blank cell)
Range("B1:B280").Find(Empty).End(xlDown).select





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
Searching for a "LESS THAN"" amount within a sheet! FLKULCHAR Excel Discussion (Misc queries) 1 February 22nd 10 03:32 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
If A3=alpha numeric,"X", if A3=text,"Y", Blank Gary Excel Worksheet Functions 16 August 8th 06 08:27 PM
Changing "returned" values from "0" to "blank" LATATC Excel Worksheet Functions 2 October 20th 05 04:41 PM


All times are GMT +1. The time now is 01:22 PM.

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

About Us

"It's about Microsoft Excel"