PC Review


Reply
Thread Tools Rate Thread

Code wont work - help please

 
 
Wes_A
Guest
Posts: n/a
 
      20th Apr 2010
My code:
Appears to run through but does not produced the expected result, only
offsets from current cell.

Sheets("AUDIT_TRAIL_MONTHLY").Select
On Error Resume Next
Range("A13:A24").Find(What:=Range("D2"), LookIn:=xlValues, _
LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False).Offset(0, 1).Activate
 
Reply With Quote
 
 
 
 
Mike H
Guest
Posts: n/a
 
      20th Apr 2010
Hi,

What do you expect it to do?

If it finds the value it will select the cell to the right and then end.
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Wes_A" wrote:

> My code:
> Appears to run through but does not produced the expected result, only
> offsets from current cell.
>
> Sheets("AUDIT_TRAIL_MONTHLY").Select
> On Error Resume Next
> Range("A13:A24").Find(What:=Range("D2"), LookIn:=xlValues, _
> LookAt:=xlWhole, SearchOrder:=xlByRows, _
> SearchDirection:=xlNext, _
> MatchCase:=False).Offset(0, 1).Activate

 
Reply With Quote
 
FSt1
Guest
Posts: n/a
 
      20th Apr 2010
hi
your code tells it to do that. remove the offset(0,1) from the find clause.

regards
FSt1

"Wes_A" wrote:

> My code:
> Appears to run through but does not produced the expected result, only
> offsets from current cell.
>
> Sheets("AUDIT_TRAIL_MONTHLY").Select
> On Error Resume Next
> Range("A13:A24").Find(What:=Range("D2"), LookIn:=xlValues, _
> LookAt:=xlWhole, SearchOrder:=xlByRows, _
> SearchDirection:=xlNext, _
> MatchCase:=False).Offset(0, 1).Activate

 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      20th Apr 2010
Your code tested fine. Must be another problem.

If desired, send your file to my address below. I will only look if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"Wes_A" <(E-Mail Removed)> wrote in message
news:4BEDC56A-4D8E-4D45-8702-(E-Mail Removed)...
> My code:
> Appears to run through but does not produced the expected result, only
> offsets from current cell.
>
> Sheets("AUDIT_TRAIL_MONTHLY").Select
> On Error Resume Next
> Range("A13:A24").Find(What:=Range("D2"), LookIn:=xlValues, _
> LookAt:=xlWhole, SearchOrder:=xlByRows, _
> SearchDirection:=xlNext, _
> MatchCase:=False).Offset(0, 1).Activate


 
Reply With Quote
 
Wes_A
Guest
Posts: n/a
 
      20th Apr 2010
What I mean is, it is not finding the matching data in the first place, sorry
if I wasn't clear in my question.

"Wes_A" wrote:

> My code:
> Appears to run through but does not produced the expected result, only
> offsets from current cell.
>
> Sheets("AUDIT_TRAIL_MONTHLY").Select
> On Error Resume Next
> Range("A13:A24").Find(What:=Range("D2"), LookIn:=xlValues, _
> LookAt:=xlWhole, SearchOrder:=xlByRows, _
> SearchDirection:=xlNext, _
> MatchCase:=False).Offset(0, 1).Activate

 
Reply With Quote
 
Mike H
Guest
Posts: n/a
 
      20th Apr 2010
> What I mean is, it is not finding the matching data in the first place

Then your data isn't a match. Check for rogue leading/trailing spaces
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Wes_A" wrote:

> What I mean is, it is not finding the matching data in the first place, sorry
> if I wasn't clear in my question.
>
> "Wes_A" wrote:
>
> > My code:
> > Appears to run through but does not produced the expected result, only
> > offsets from current cell.
> >
> > Sheets("AUDIT_TRAIL_MONTHLY").Select
> > On Error Resume Next
> > Range("A13:A24").Find(What:=Range("D2"), LookIn:=xlValues, _
> > LookAt:=xlWhole, SearchOrder:=xlByRows, _
> > SearchDirection:=xlNext, _
> > MatchCase:=False).Offset(0, 1).Activate

 
Reply With Quote
 
Rick Rothstein
Guest
Posts: n/a
 
      20th Apr 2010
Can you give us an example of data it won't find?

--
Rick (MVP - Excel)



"Wes_A" <(E-Mail Removed)> wrote in message
news947B75D-6F9A-4BE0-B8B2-(E-Mail Removed)...
> What I mean is, it is not finding the matching data in the first place,
> sorry
> if I wasn't clear in my question.
>
> "Wes_A" wrote:
>
>> My code:
>> Appears to run through but does not produced the expected result, only
>> offsets from current cell.
>>
>> Sheets("AUDIT_TRAIL_MONTHLY").Select
>> On Error Resume Next
>> Range("A13:A24").Find(What:=Range("D2"), LookIn:=xlValues, _
>> LookAt:=xlWhole, SearchOrder:=xlByRows, _
>> SearchDirection:=xlNext, _
>> MatchCase:=False).Offset(0, 1).Activate


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code wont work SF Microsoft Access VBA Modules 2 19th Dec 2007 03:12 PM
Why wont this code work? Mark Stephens Microsoft Excel Programming 1 30th Apr 2005 07:01 PM
right click wont work, restore wont work, java wont install =?Utf-8?B?am9obm55bW90aW9u?= Windows XP Help 1 17th Jan 2005 07:51 PM
Why wont this code work Josie Microsoft Access Form Coding 8 10th Sep 2004 09:23 PM
My code wont work Why? Tony Williams Microsoft Access Form Coding 4 1st Apr 2004 08:27 PM


Features
 

Advertising
 

Newsgroups
 


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