PC Review


Reply
Thread Tools Rate Thread

Application.Match - Is it possible to use named ranges?

 
 
Mike G - DC
Guest
Posts: n/a
 
      8th Jul 2009
Folks –
I’m working to answer my own question in a posting yesterday, Subject:
Add/Update data stored in another worksheet 7/7/2009 2:09 PM PST, (Shameless
Bump).

The first step in resolving my issue is to identify if a part number in
sheet 1 “TSCREEN” range A11:A24 is in the range A:A in sheet2 (TDATA). I
found the following code in another post which gets me close. I’m wondering
if I can use either a named range or cell reference within the match function
rather than actually listing the specific part name in the code.

Dim R As Variant 'could be an error
Dim Trange As Range
Set Trange = Sheets("TDATA").Range("A:A")
R = Application.Match("axle", Trange, 0)
If IsError(R) Then
MsgBox "not found"
Else
MsgBox "found"
End If

Any help is much appreciated - mike

 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      8th Jul 2009

R = Application.Match(Range("axle"), Trange, 0)

it is still a range

--
__________________________________
HTH

Bob

"Mike G - DC" <(E-Mail Removed)> wrote in message
news:E8F1126F-E19E-4D07-AF3E-(E-Mail Removed)...
> Folks -
> I'm working to answer my own question in a posting yesterday, Subject:
> Add/Update data stored in another worksheet 7/7/2009 2:09 PM PST,
> (Shameless
> Bump).
>
> The first step in resolving my issue is to identify if a part number in
> sheet 1 "TSCREEN" range A11:A24 is in the range A:A in sheet2 (TDATA). I
> found the following code in another post which gets me close. I'm
> wondering
> if I can use either a named range or cell reference within the match
> function
> rather than actually listing the specific part name in the code.
>
> Dim R As Variant 'could be an error
> Dim Trange As Range
> Set Trange = Sheets("TDATA").Range("A:A")
> R = Application.Match("axle", Trange, 0)
> If IsError(R) Then
> MsgBox "not found"
> Else
> MsgBox "found"
> End If
>
> Any help is much appreciated - mike
>



 
Reply With Quote
 
Mike G - DC
Guest
Posts: n/a
 
      8th Jul 2009
excellent. Thankyou

"Bob Phillips" wrote:

> R = Application.Match(Range("axle"), Trange, 0)
>
> it is still a range
>
> --
> __________________________________
> HTH
>
> Bob
>
> "Mike G - DC" <(E-Mail Removed)> wrote in message
> news:E8F1126F-E19E-4D07-AF3E-(E-Mail Removed)...
> > Folks -
> > I'm working to answer my own question in a posting yesterday, Subject:
> > Add/Update data stored in another worksheet 7/7/2009 2:09 PM PST,
> > (Shameless
> > Bump).
> >
> > The first step in resolving my issue is to identify if a part number in
> > sheet 1 "TSCREEN" range A11:A24 is in the range A:A in sheet2 (TDATA). I
> > found the following code in another post which gets me close. I'm
> > wondering
> > if I can use either a named range or cell reference within the match
> > function
> > rather than actually listing the specific part name in the code.
> >
> > Dim R As Variant 'could be an error
> > Dim Trange As Range
> > Set Trange = Sheets("TDATA").Range("A:A")
> > R = Application.Match("axle", Trange, 0)
> > If IsError(R) Then
> > MsgBox "not found"
> > Else
> > MsgBox "found"
> > End If
> >
> > Any help is much appreciated - mike
> >

>
>
>

 
Reply With Quote
 
Mike G - DC
Guest
Posts: n/a
 
      10th Jul 2009
Bob - Is it possible to use a formula within Application.Match to identify
the string to look for? The following code runs, but the match is not found
even though it is present within Trange.
Thanks, Mike

Dim R As Variant 'could be an error
Dim Trange As Range

Set Trange = Sheets("TOURDATA").Range("A:A")

R = Application.Match(FormulaR1C1 = "=CONCATENATE(userid,dayone)", Trange2, 0)

If IsError(R) Then
MsgBox "Not found"
Else
MsgBox "found"
End If

End Sub

"Bob Phillips" wrote:

> R = Application.Match(Range("axle"), Trange, 0)
>
> it is still a range
>
> --
> __________________________________
> HTH
>
> Bob
>
> "Mike G - DC" <(E-Mail Removed)> wrote in message
> news:E8F1126F-E19E-4D07-AF3E-(E-Mail Removed)...
> > Folks -
> > I'm working to answer my own question in a posting yesterday, Subject:
> > Add/Update data stored in another worksheet 7/7/2009 2:09 PM PST,
> > (Shameless
> > Bump).
> >
> > The first step in resolving my issue is to identify if a part number in
> > sheet 1 "TSCREEN" range A11:A24 is in the range A:A in sheet2 (TDATA). I
> > found the following code in another post which gets me close. I'm
> > wondering
> > if I can use either a named range or cell reference within the match
> > function
> > rather than actually listing the specific part name in the code.
> >
> > Dim R As Variant 'could be an error
> > Dim Trange As Range
> > Set Trange = Sheets("TDATA").Range("A:A")
> > R = Application.Match("axle", Trange, 0)
> > If IsError(R) Then
> > MsgBox "not found"
> > Else
> > MsgBox "found"
> > End If
> >
> > Any help is much appreciated - mike
> >

>
>
>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      10th Jul 2009
I'm not sure what userid and dayone are, but maybe:

R = Application.Match(userid & dayone, Trange2, 0)
or
R = Application.Match(range("userid").value & range("dayone").value, Trange2, 0)



Mike G - DC wrote:
>
> Bob - Is it possible to use a formula within Application.Match to identify
> the string to look for? The following code runs, but the match is not found
> even though it is present within Trange.
> Thanks, Mike
>
> Dim R As Variant 'could be an error
> Dim Trange As Range
>
> Set Trange = Sheets("TOURDATA").Range("A:A")
>
> R = Application.Match(FormulaR1C1 = "=CONCATENATE(userid,dayone)", Trange2, 0)
>
> If IsError(R) Then
> MsgBox "Not found"
> Else
> MsgBox "found"
> End If
>
> End Sub
>
> "Bob Phillips" wrote:
>
> > R = Application.Match(Range("axle"), Trange, 0)
> >
> > it is still a range
> >
> > --
> > __________________________________
> > HTH
> >
> > Bob
> >
> > "Mike G - DC" <(E-Mail Removed)> wrote in message
> > news:E8F1126F-E19E-4D07-AF3E-(E-Mail Removed)...
> > > Folks -
> > > I'm working to answer my own question in a posting yesterday, Subject:
> > > Add/Update data stored in another worksheet 7/7/2009 2:09 PM PST,
> > > (Shameless
> > > Bump).
> > >
> > > The first step in resolving my issue is to identify if a part number in
> > > sheet 1 "TSCREEN" range A11:A24 is in the range A:A in sheet2 (TDATA). I
> > > found the following code in another post which gets me close. I'm
> > > wondering
> > > if I can use either a named range or cell reference within the match
> > > function
> > > rather than actually listing the specific part name in the code.
> > >
> > > Dim R As Variant 'could be an error
> > > Dim Trange As Range
> > > Set Trange = Sheets("TDATA").Range("A:A")
> > > R = Application.Match("axle", Trange, 0)
> > > If IsError(R) Then
> > > MsgBox "not found"
> > > Else
> > > MsgBox "found"
> > > End If
> > >
> > > Any help is much appreciated - mike
> > >

> >
> >
> >


--

Dave Peterson
 
Reply With Quote
 
Mike G - DC
Guest
Posts: n/a
 
      10th Jul 2009

Bingo! R = Application.Match(range("userid").value & range("dayone").value,
Trange2, 0). userid and dayone are named ranges. Also, I noticed that Trange2
should be Trange. Not sure where the 2 came from.

Thanks so much for your advice.
mike

"Dave Peterson" wrote:

> I'm not sure what userid and dayone are, but maybe:
>
> R = Application.Match(userid & dayone, Trange2, 0)
> or
> R = Application.Match(range("userid").value & range("dayone").value, Trange2, 0)
>
>
>
> Mike G - DC wrote:
> >
> > Bob - Is it possible to use a formula within Application.Match to identify
> > the string to look for? The following code runs, but the match is not found
> > even though it is present within Trange.
> > Thanks, Mike
> >
> > Dim R As Variant 'could be an error
> > Dim Trange As Range
> >
> > Set Trange = Sheets("TOURDATA").Range("A:A")
> >
> > R = Application.Match(FormulaR1C1 = "=CONCATENATE(userid,dayone)", Trange2, 0)
> >
> > If IsError(R) Then
> > MsgBox "Not found"
> > Else
> > MsgBox "found"
> > End If
> >
> > End Sub
> >
> > "Bob Phillips" wrote:
> >
> > > R = Application.Match(Range("axle"), Trange, 0)
> > >
> > > it is still a range
> > >
> > > --
> > > __________________________________
> > > HTH
> > >
> > > Bob
> > >
> > > "Mike G - DC" <(E-Mail Removed)> wrote in message
> > > news:E8F1126F-E19E-4D07-AF3E-(E-Mail Removed)...
> > > > Folks -
> > > > I'm working to answer my own question in a posting yesterday, Subject:
> > > > Add/Update data stored in another worksheet 7/7/2009 2:09 PM PST,
> > > > (Shameless
> > > > Bump).
> > > >
> > > > The first step in resolving my issue is to identify if a part number in
> > > > sheet 1 "TSCREEN" range A11:A24 is in the range A:A in sheet2 (TDATA). I
> > > > found the following code in another post which gets me close. I'm
> > > > wondering
> > > > if I can use either a named range or cell reference within the match
> > > > function
> > > > rather than actually listing the specific part name in the code.
> > > >
> > > > Dim R As Variant 'could be an error
> > > > Dim Trange As Range
> > > > Set Trange = Sheets("TDATA").Range("A:A")
> > > > R = Application.Match("axle", Trange, 0)
> > > > If IsError(R) Then
> > > > MsgBox "not found"
> > > > Else
> > > > MsgBox "found"
> > > > End If
> > > >
> > > > Any help is much appreciated - mike
> > > >
> > >
> > >
> > >

>
> --
>
> Dave Peterson
>

 
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
Named ranges scope / workbook/worksheet level named ranges- changeswith variable use... christian_spaceman Microsoft Excel Programming 3 24th Dec 2007 01:15 PM
Named range scope question (using application.match) Keith Microsoft Excel Programming 2 1st Feb 2007 09:42 PM
Application.Match and Ranges gimme_this_gimme_that@yahoo.com Microsoft Excel Programming 2 6th Nov 2006 06:55 AM
Copy data in named ranges to a newer version of the same template to identical ranges handstand Microsoft Excel Programming 0 21st Aug 2006 03:51 PM
Inserting named ranges into Match and Vlookup dancing fish Microsoft Excel Misc 3 18th Jan 2004 05:36 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:39 PM.