#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default Range Issue


HeadingsToSync = Array("111", "222", "333", "ABC", "ABC %Total", "123ABC /
321CBA")
For y = LBound(HeadingsToSync) To UBound(HeadingsToSync)

Set rngFound = Cells.Find(What:=y, _
After:=ActiveCell, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=True, _
SearchFormat:=False)

If rngFound Is Nothing Then

Else
rngFound.Select

Next y
================================
Manually searching for 111 works fine.
Not sure why the above approach when stepping through rngFound.Select does
not get me to that cell with a value of 111€¦

Appreciatively,
Arturo
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Range Issue

Probably because the value in your worksheet is a number (111) while the
value in your array is Text.

In article ,
Arturo wrote:

HeadingsToSync = Array("111", "222", "333", "ABC", "ABC %Total", "123ABC /
321CBA")
For y = LBound(HeadingsToSync) To UBound(HeadingsToSync)

Set rngFound = Cells.Find(What:=y, _
After:=ActiveCell, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=True, _
SearchFormat:=False)

If rngFound Is Nothing Then

Else
rngFound.Select

Next y
================================
Manually searching for 111 works fine.
Not sure why the above approach when stepping through rngFound.Select does
not get me to that cell with a value of 111€¦

Appreciatively,
Arturo

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default Range Issue

Any suggestions.


"JE McGimpsey" wrote:

Probably because the value in your worksheet is a number (111) while the
value in your array is Text.

In article ,
Arturo wrote:

HeadingsToSync = Array("111", "222", "333", "ABC", "ABC %Total", "123ABC /
321CBA")
For y = LBound(HeadingsToSync) To UBound(HeadingsToSync)

Set rngFound = Cells.Find(What:=y, _
After:=ActiveCell, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=True, _
SearchFormat:=False)

If rngFound Is Nothing Then

Else
rngFound.Select

Next y
================================
Manually searching for 111 works fine.
Not sure why the above approach when stepping through rngFound.Select does
not get me to that cell with a value of 111€¦

Appreciatively,
Arturo


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Range Issue

Instead of:
Set rngFound = Cells.Find(What:=y, _
you may want:
Set rngFound = Cells.Find(What:=headingstosync(y), _

Y is still just the index--not the value. (Refer to your earlier post.)


Arturo wrote:

Any suggestions.

"JE McGimpsey" wrote:

Probably because the value in your worksheet is a number (111) while the
value in your array is Text.

In article ,
Arturo wrote:

HeadingsToSync = Array("111", "222", "333", "ABC", "ABC %Total", "123ABC /
321CBA")
For y = LBound(HeadingsToSync) To UBound(HeadingsToSync)

Set rngFound = Cells.Find(What:=y, _
After:=ActiveCell, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=True, _
SearchFormat:=False)

If rngFound Is Nothing Then

Else
rngFound.Select

Next y
================================
Manually searching for 111 works fine.
Not sure why the above approach when stepping through rngFound.Select does
not get me to that cell with a value of 111€¦

Appreciatively,
Arturo



--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Range Issue

You are searching for the index in the array in this case 0,1,2,3,4,5

try the following:

Dim HeadingsToSync As Variant
Dim y As Integer
Dim rngFound As Range

HeadingsToSync = Array("111", "222", "333", "ABC", "ABC %Total", "123ABC
/321 CBA ")
For y = LBound(HeadingsToSync) To UBound(HeadingsToSync)

Set rngFound = Cells.Find(What:=HeadingsToSync(y), _
After:=ActiveCell, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=True, _
SearchFormat:=False)

If rngFound Is Nothing Then

Else
rngFound.Select
End If


Next y

"Arturo" wrote:

Any suggestions.


"JE McGimpsey" wrote:

Probably because the value in your worksheet is a number (111) while the
value in your array is Text.

In article ,
Arturo wrote:

HeadingsToSync = Array("111", "222", "333", "ABC", "ABC %Total", "123ABC /
321CBA")
For y = LBound(HeadingsToSync) To UBound(HeadingsToSync)

Set rngFound = Cells.Find(What:=y, _
After:=ActiveCell, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=True, _
SearchFormat:=False)

If rngFound Is Nothing Then

Else
rngFound.Select

Next y
================================
Manually searching for 111 works fine.
Not sure why the above approach when stepping through rngFound.Select does
not get me to that cell with a value of 111€¦

Appreciatively,
Arturo


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
Range Name issue Barb Reinhardt Excel Programming 5 September 8th 06 04:59 PM
Range issue evil baby[_13_] Excel Programming 3 March 7th 06 03:59 PM
Range issue... James Excel Programming 4 August 4th 05 09:26 PM
Copy Range Issue SIGE Excel Programming 15 April 5th 05 04:57 PM
Excel Range issue Rohit Nayak Excel Programming 2 November 19th 04 03:10 PM


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