Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
raj raj is offline
external usenet poster
 
Posts: 32
Default special cell selection

Hello. I hope someone can help me with this please.

I would like to be able to select the visible cells in the
used range of column "B" in a sheet.

Ideally, it would do so in a single line of VBA code.
Your example code would be most appreciated. Thanks in
advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
raj raj is offline
external usenet poster
 
Posts: 32
Default special cell selection

NEVERMIND. I figured it out (duh):

Application.Intersect(Range("B:B") _
.SpecialCells(xlCellTypeVisible), _
Range(ActiveSheet.UsedRange.Address)).Select


-----Original Message-----
Hello. I hope someone can help me with this please.

I would like to be able to select the visible cells in

the
used range of column "B" in a sheet.

Ideally, it would do so in a single line of VBA code.
Your example code would be most appreciated. Thanks in
advance.
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default special cell selection

On Error Resume Next
Columns(2).SpecialCells(xlVisible).Select
On Error goto 0

might be a bit simpler.

Special cells restricts itself to the usedrange, so you don't need to do the
intersect.

--
Regards,
Tom Ogilvy

raj wrote in message
...
NEVERMIND. I figured it out (duh):

Application.Intersect(Range("B:B") _
.SpecialCells(xlCellTypeVisible), _
Range(ActiveSheet.UsedRange.Address)).Select


-----Original Message-----
Hello. I hope someone can help me with this please.

I would like to be able to select the visible cells in

the
used range of column "B" in a sheet.

Ideally, it would do so in a single line of VBA code.
Your example code would be most appreciated. Thanks in
advance.
.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default special cell selection

or

With ActiveSheet
Intersect(.Range("b:b").SpecialCells(xlCellTypeVis ible), _
.UsedRange).Select
End With

(and watch out. if there are no visible cells, then you'll get an error.)


raj wrote:

NEVERMIND. I figured it out (duh):

Application.Intersect(Range("B:B") _
.SpecialCells(xlCellTypeVisible), _
Range(ActiveSheet.UsedRange.Address)).Select

-----Original Message-----
Hello. I hope someone can help me with this please.

I would like to be able to select the visible cells in

the
used range of column "B" in a sheet.

Ideally, it would do so in a single line of VBA code.
Your example code would be most appreciated. Thanks in
advance.
.


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default special cell selection

UsedRange, of course, is redundant.

--
Regards,
Tom Ogilvy

Dave Peterson wrote in message
...
or

With ActiveSheet
Intersect(.Range("b:b").SpecialCells(xlCellTypeVis ible), _
.UsedRange).Select
End With

(and watch out. if there are no visible cells, then you'll get an error.)


raj wrote:

NEVERMIND. I figured it out (duh):

Application.Intersect(Range("B:B") _
.SpecialCells(xlCellTypeVisible), _
Range(ActiveSheet.UsedRange.Address)).Select

-----Original Message-----
Hello. I hope someone can help me with this please.

I would like to be able to select the visible cells in

the
used range of column "B" in a sheet.

Ideally, it would do so in a single line of VBA code.
Your example code would be most appreciated. Thanks in
advance.
.


--

Dave Peterson





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default special cell selection

Yep.

I saw your response and said "doh". I hope Tom doesn't read mine.

Tom Ogilvy wrote:

UsedRange, of course, is redundant.

--
Regards,
Tom Ogilvy

Dave Peterson wrote in message
...
or

With ActiveSheet
Intersect(.Range("b:b").SpecialCells(xlCellTypeVis ible), _
.UsedRange).Select
End With

(and watch out. if there are no visible cells, then you'll get an error.)


raj wrote:

NEVERMIND. I figured it out (duh):

Application.Intersect(Range("B:B") _
.SpecialCells(xlCellTypeVisible), _
Range(ActiveSheet.UsedRange.Address)).Select

-----Original Message-----
Hello. I hope someone can help me with this please.

I would like to be able to select the visible cells in
the
used range of column "B" in a sheet.

Ideally, it would do so in a single line of VBA code.
Your example code would be most appreciated. Thanks in
advance.
.


--

Dave Peterson


--

Dave Peterson

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,979
Default special cell selection

An interesting note (well to me anyway <g) --

If any cell outside the used range is currently selected, your code
selects just the visible cells in the the used range in column B, and
Tom's selects all visible cells in column B.

Dave Peterson wrote:
Yep.

I saw your response and said "doh". I hope Tom doesn't read mine.

Tom Ogilvy wrote:

UsedRange, of course, is redundant.

--
Regards,
Tom Ogilvy

Dave Peterson wrote in message
...

or

With ActiveSheet
Intersect(.Range("b:b").SpecialCells(xlCellTypeVis ible), _
.UsedRange).Select
End With

(and watch out. if there are no visible cells, then you'll get an error.)


raj wrote:

NEVERMIND. I figured it out (duh):

Application.Intersect(Range("B:B") _
.SpecialCells(xlCellTypeVisible), _
Range(ActiveSheet.UsedRange.Address)).Select


-----Original Message-----
Hello. I hope someone can help me with this please.

I would like to be able to select the visible cells in

the

used range of column "B" in a sheet.

Ideally, it would do so in a single line of VBA code.
Your example code would be most appreciated. Thanks in
advance.
.


--

Dave Peterson





--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default special cell selection

I believe I am wrong on this - so my apologies to Dave and the OP.

Anyway
On Error Resume Next
set rng = Activesheet.UsedRange.Columns(2).Specialcells(xlVi sible)
On Error goto 0

although this assumes column A is in the used range.
--
Regards,
Tom Ogilvy


Debra Dalgleish wrote in message
...
An interesting note (well to me anyway <g) --

If any cell outside the used range is currently selected, your code
selects just the visible cells in the the used range in column B, and
Tom's selects all visible cells in column B.

Dave Peterson wrote:
Yep.

I saw your response and said "doh". I hope Tom doesn't read mine.

Tom Ogilvy wrote:

UsedRange, of course, is redundant.

--
Regards,
Tom Ogilvy

Dave Peterson wrote in message
...

or

With ActiveSheet
Intersect(.Range("b:b").SpecialCells(xlCellTypeVis ible), _
.UsedRange).Select
End With

(and watch out. if there are no visible cells, then you'll get an

error.)


raj wrote:

NEVERMIND. I figured it out (duh):

Application.Intersect(Range("B:B") _
.SpecialCells(xlCellTypeVisible), _
Range(ActiveSheet.UsedRange.Address)).Select


-----Original Message-----
Hello. I hope someone can help me with this please.

I would like to be able to select the visible cells in

the

used range of column "B" in a sheet.

Ideally, it would do so in a single line of VBA code.
Your example code would be most appreciated. Thanks in
advance.
.


--

Dave Peterson





--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html



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
Limiting selection in a cell AND linking that selection to a list Lisa Excel Discussion (Misc queries) 1 July 28th 09 05:00 PM
How flip a selection before pasting - Paste special ruks Excel Discussion (Misc queries) 2 May 31st 06 06:38 PM
In Excel: Paste Special should have a "Link Value" Selection Deon Isis Excel Worksheet Functions 0 June 30th 05 02:12 PM
limit cell list selection based on the selection of another list lorraine Excel Worksheet Functions 2 December 14th 04 08:17 PM
Delete all special characters in a selection? ali Excel Programming 4 December 7th 03 08:45 PM


All times are GMT +1. The time now is 01:51 AM.

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"