Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Setting ranges

how would i set a range for all non empty cells in column
a on a sheet?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Setting ranges

Hi
you may try the following to select all non blank cells in column A
Sub foo2()

Dim rng As Range
Dim cell As Range
Dim target_rng As Range
Set rng = Range("A:A")
For Each cell In rng
If cell.Value < "" Then
If target_rng Is Nothing Then
Set target_rng = cell
Else
Set target_rng = Union(target_rng, cell)
End If
End If
Next
target_rng.Select
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany

Scottie wrote:
how would i set a range for all non empty cells in column
a on a sheet?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Setting ranges

Scottie,

Something like

Set myRange = columns(1).specialcells(xlcelltypeblanks)

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Scottie" wrote in message
...
how would i set a range for all non empty cells in column
a on a sheet?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default Setting ranges

Hi Scottie.

Sub findAll1()
Dim Str As String, c As Range
For Each c In Range("D2:D18")
If c.Value < "" Then Str = Str & "," & c.Address
Next c
Range(Mid(Str, 2, Len(Str))).Select
End Sub

Or just sort the column?

Regards Robert

"Scottie" wrote in message ...
how would i set a range for all non empty cells in column
a on a sheet?



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.593 / Virus Database: 376 - Release Date: 20/02/2004


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
setting more than one condition and multiple ranges Sapper Excel Discussion (Misc queries) 1 April 23rd 09 11:32 AM
dynamic setting of data ranges Patrick Charts and Charting in Excel 1 January 7th 08 08:51 AM
Setting multiple ranges to print bluegrassstateworker Excel Discussion (Misc queries) 0 May 1st 07 08:21 PM
help with setting up dynamic name ranges Jeff Excel Worksheet Functions 5 September 22nd 06 02:07 PM
Setting PrintArea by using Named Ranges Oren Klaber Excel Programming 2 January 30th 04 10:34 PM


All times are GMT +1. The time now is 02:12 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"