Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Excel 2003 'SpecialCells' VBA cell Selection - how do I do this? Helpneeded please

Hi,

I have a piece of code that puts an error "NA()" in column W if the ID
in column A is not found on a reference worksheet ...

like this:
Range("W2:W" & Range("A1").End(xlDown).Row).Formula =
"=IF(COUNTIF(A:A,Recon_Activity!T:T)=0,NA(),"" "")"

Normally, say I want to select the entire row of all the ones with an
error put in by the formula, I can use this:

Range("A2:W" &
Range("A1").End(xlDown).Row).SpecialCells(xlCellTy peFormulas,
xlErrors).EntireRow.Select

or I can in one step delete them all.

However, I would like to select the cells in column A where an error
value is found in column W ... much the same as above, but I would
instead of selectiing the entire row, how do I try and select the
cells in column A where there is an error on the same row in column
W...

I tried the below but it doesn't work:

Range("A2:W" &
Range("A1").End(xlDown).Row).SpecialCells(xlCellTy peFormulas,
xlErrors).Rows(0,1).select

thanks for any help
Philip
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Excel 2003 'SpecialCells' VBA cell Selection - how do I do this? Help needed please

Dim rng As Range, ar As Range
On Error Resume Next
Set rng = Range("A2:W" & Range("A1").End(xlDown).Row). _
SpecialCells(xlCellTypeFormulas, xlErrors).EntireRow
On Error GoTo 0

If Not rng Is Nothing Then

For Each ar In rng.Areas
' for testing change colour
ar.Columns(1).Interior.ColorIndex = 6
'ar.Clear
' or
'ar.ClearContents
Next
Else
MsgBox "no cells found"
End If


Uncomment Clear or ClearContents to "delete" them, if that's all you want to
do. However if you need to build a new range of all the 'relative' cells in
col-a you could build a new range with Union of each 'ar'

Regards,
Peter T

wrote in message
...
Hi,

I have a piece of code that puts an error "NA()" in column W if the ID
in column A is not found on a reference worksheet ...

like this:
Range("W2:W" & Range("A1").End(xlDown).Row).Formula =
"=IF(COUNTIF(A:A,Recon_Activity!T:T)=0,NA(),"" "")"

Normally, say I want to select the entire row of all the ones with an
error put in by the formula, I can use this:

Range("A2:W" &
Range("A1").End(xlDown).Row).SpecialCells(xlCellTy peFormulas,
xlErrors).EntireRow.Select

or I can in one step delete them all.

However, I would like to select the cells in column A where an error
value is found in column W ... much the same as above, but I would
instead of selectiing the entire row, how do I try and select the
cells in column A where there is an error on the same row in column
W...

I tried the below but it doesn't work:

Range("A2:W" &
Range("A1").End(xlDown).Row).SpecialCells(xlCellTy peFormulas,
xlErrors).Rows(0,1).select

thanks for any help
Philip



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Excel 2003 'SpecialCells' VBA cell Selection - how do I do this? Help needed please

Ignore this go with Bernie's !

- wasn't thinking ):-

Regards,
Peter T

"Peter T" <peter_t@discussions wrote in message
...
Dim rng As Range, ar As Range
On Error Resume Next
Set rng = Range("A2:W" & Range("A1").End(xlDown).Row). _
SpecialCells(xlCellTypeFormulas, xlErrors).EntireRow
On Error GoTo 0

If Not rng Is Nothing Then

For Each ar In rng.Areas
' for testing change colour
ar.Columns(1).Interior.ColorIndex = 6
'ar.Clear
' or
'ar.ClearContents
Next
Else
MsgBox "no cells found"
End If


Uncomment Clear or ClearContents to "delete" them, if that's all you want

to
do. However if you need to build a new range of all the 'relative' cells

in
col-a you could build a new range with Union of each 'ar'

Regards,
Peter T

wrote in message
...
Hi,

I have a piece of code that puts an error "NA()" in column W if the ID
in column A is not found on a reference worksheet ...

like this:
Range("W2:W" & Range("A1").End(xlDown).Row).Formula =
"=IF(COUNTIF(A:A,Recon_Activity!T:T)=0,NA(),"" "")"

Normally, say I want to select the entire row of all the ones with an
error put in by the formula, I can use this:

Range("A2:W" &
Range("A1").End(xlDown).Row).SpecialCells(xlCellTy peFormulas,
xlErrors).EntireRow.Select

or I can in one step delete them all.

However, I would like to select the cells in column A where an error
value is found in column W ... much the same as above, but I would
instead of selectiing the entire row, how do I try and select the
cells in column A where there is an error on the same row in column
W...

I tried the below but it doesn't work:

Range("A2:W" &
Range("A1").End(xlDown).Row).SpecialCells(xlCellTy peFormulas,
xlErrors).Rows(0,1).select

thanks for any help
Philip





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Excel 2003 'SpecialCells' VBA cell Selection - how do I do this? Help needed please

Range("W:W").SpecialCells(xlCellTypeFormulas, _
xlErrors).Offset(0, -22).Select

HTH,
Bernie
MS Excel MVP


wrote in message
...
Hi,

I have a piece of code that puts an error "NA()" in column W if the ID
in column A is not found on a reference worksheet ...

like this:
Range("W2:W" & Range("A1").End(xlDown).Row).Formula =
"=IF(COUNTIF(A:A,Recon_Activity!T:T)=0,NA(),"" "")"

Normally, say I want to select the entire row of all the ones with an
error put in by the formula, I can use this:

Range("A2:W" &
Range("A1").End(xlDown).Row).SpecialCells(xlCellTy peFormulas,
xlErrors).EntireRow.Select

or I can in one step delete them all.

However, I would like to select the cells in column A where an error
value is found in column W ... much the same as above, but I would
instead of selectiing the entire row, how do I try and select the
cells in column A where there is an error on the same row in column
W...

I tried the below but it doesn't work:

Range("A2:W" &
Range("A1").End(xlDown).Row).SpecialCells(xlCellTy peFormulas,
xlErrors).Rows(0,1).select

thanks for any help
Philip



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Excel 2003 'SpecialCells' VBA cell Selection - how do I do this?Help needed please

On Apr 28, 6:00*pm, "Bernie Deitrick" <deitbe @ consumer dot org
wrote:
Range("W:W").SpecialCells(xlCellTypeFormulas, _
xlErrors).Offset(0, -22).Select

HTH,
Bernie
MS Excel MVP

wrote in message

...



Hi,


I have a piece of code that puts an error "NA()" in column W if the ID
in column A is not found on a reference worksheet ...


like this:
Range("W2:W" & Range("A1").End(xlDown).Row).Formula =
"=IF(COUNTIF(A:A,Recon_Activity!T:T)=0,NA(),"" "")"


Normally, say I want to select the entire row of all the ones with an
error put in by the formula, I can use this:


Range("A2:W" &
Range("A1").End(xlDown).Row).SpecialCells(xlCellTy peFormulas,
xlErrors).EntireRow.Select


or I can in one step delete them all.


However, I would like to select the cells in column A where an error
value is found in column W ... much the same as above, but I would
instead of selectiing the entire row, how do I try and select the
cells in column A where there is an error on the same row in column
W...


I tried the below but it doesn't work:


Range("A2:W" &
Range("A1").End(xlDown).Row).SpecialCells(xlCellTy peFormulas,
xlErrors).Rows(0,1).select


thanks for any help
Philip- Hide quoted text -


- Show quoted text -


Thanks - that's perfect !

Philip


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
Case selection in Excel 2003 m2work Excel Worksheet Functions 5 November 1st 08 08:21 PM
Copying Excel 2003 Selection into Outlook 2003 HTML E-Mail Message [email protected] Excel Discussion (Misc queries) 0 July 10th 06 03:07 PM
Excel 2003, Windows XP, Stuck in Cell Selection Mode Birdjaf Excel Discussion (Misc queries) 1 June 22nd 06 07:07 PM
Excel 2003 - Selection Tool Always ON screwie Excel Discussion (Misc queries) 4 May 6th 05 06:06 AM
Multi-selection problem in Excel XP and 2003 Vicente Zambrano Excel Discussion (Misc queries) 0 February 10th 05 11:29 PM


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