Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Searching one cell


So here's my search to a single cell
Dim sheetName As String
sheetName = ActiveSheet.Name
Dim find_criteria As Range
Set find_criteria
Worksheets(sheetName).Range(Selection).Find(What:= "<",
Lookat:=xlPart, LookIn:=xlFormula, MatchCase:=False)

I keep getting subscript out of range.

Any ideas?

Thanks,

Chri

--
cbh3571
-----------------------------------------------------------------------
cbh35711's Profile: http://www.excelforum.com/member.php...fo&userid=3027
View this thread: http://www.excelforum.com/showthread.php?threadid=52961

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,316
Default Searching one cell

If the code in your module is word wrapping the way the code in the post is,
you need to indicate that the code continues on the next line.

Set find_criteria = _
Worksheets(sheetName).Range(Selection).Find(What:= "<", _
Lookat:=xlPart, LookIn:=xlFormula, MatchCase:=False)

The underscore, always preceded by a space, indicates that the code is
continued on the next line
--
Kevin Backmann


"cbh35711" wrote:


So here's my search to a single cell
Dim sheetName As String
sheetName = ActiveSheet.Name
Dim find_criteria As Range
Set find_criteria =
Worksheets(sheetName).Range(Selection).Find(What:= "<",
Lookat:=xlPart, LookIn:=xlFormula, MatchCase:=False)

I keep getting subscript out of range.

Any ideas?

Thanks,

Chris


--
cbh35711
------------------------------------------------------------------------
cbh35711's Profile: http://www.excelforum.com/member.php...o&userid=30276
View this thread: http://www.excelforum.com/showthread...hreadid=529619


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Searching one cell


That's just what this editor did to it...
I've got it as one line in my macro, but i keep getting subscript ou
of range error.

Thanks guys,

Chri

--
cbh3571
-----------------------------------------------------------------------
cbh35711's Profile: http://www.excelforum.com/member.php...fo&userid=3027
View this thread: http://www.excelforum.com/showthread.php?threadid=52961

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Searching one cell


your problem is xlformula. It should be xlformulas. Apparently somebody in
Microsoft doesn't know that formula is already plural.

good luck
kanan
"cbh35711" wrote:


That's just what this editor did to it...
I've got it as one line in my macro, but i keep getting subscript out
of range error.

Thanks guys,

Chris


--
cbh35711
------------------------------------------------------------------------
cbh35711's Profile: http://www.excelforum.com/member.php...o&userid=30276
View this thread: http://www.excelforum.com/showthread...hreadid=529619


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Searching one cell


yeah...arg, ok that's an easy fix. I'll try it when i get to work
tomorrow.

Thanks man last thing i have in my macro :)

Chris


--
cbh35711
------------------------------------------------------------------------
cbh35711's Profile: http://www.excelforum.com/member.php...o&userid=30276
View this thread: http://www.excelforum.com/showthread...hreadid=529619



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Searching one cell


Well that didn't work...
I added the s in xlFormulas, but i still get an error.
"Application defined or object defined error." sigh...

I'm just trying to see if there's a < in the current cell.
This is what i have now, just one line however this shows it.

Set find_criteria =
Worksheets(sheetName).Range(Selection).Find(What:= "<", Lookat:=xlPart,
LookIn:=xlFormulas, MatchCase:=False)



Thanks for any help you can offer,

Chris


--
cbh35711
------------------------------------------------------------------------
cbh35711's Profile: http://www.excelforum.com/member.php...o&userid=30276
View this thread: http://www.excelforum.com/showthread...hreadid=529619

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Searching one cell

I think there may be a problem with the 'Selection' clause. it worked When I
changed your code to this :
Set find_criteria = worksheets(sheetname).Range("A1:B500").Find(What:= "<",
Lookat:=xlPart, LookIn:=xlFormulas, MatchCase:=False)

So you may want to change it to ' With .. End with' statement or specify
some kind of range like "A1:Z65000"... or something like that.

Kanan

"cbh35711" wrote:


Well that didn't work...
I added the s in xlFormulas, but i still get an error.
"Application defined or object defined error." sigh...

I'm just trying to see if there's a < in the current cell.
This is what i have now, just one line however this shows it.

Set find_criteria =
Worksheets(sheetName).Range(Selection).Find(What:= "<", Lookat:=xlPart,
LookIn:=xlFormulas, MatchCase:=False)



Thanks for any help you can offer,

Chris


--
cbh35711
------------------------------------------------------------------------
cbh35711's Profile: http://www.excelforum.com/member.php...o&userid=30276
View this thread: http://www.excelforum.com/showthread...hreadid=529619


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Searching one cell


So is there a way that i can search only one cell?
I can't really put in a specific range in like that, because i want i
to just be the active cell.

I've also tried
set rng = selection
and then trying range(rng), but that doesn't work either...

Any idea anyone?

Thanks

Chri

--
cbh3571
-----------------------------------------------------------------------
cbh35711's Profile: http://www.excelforum.com/member.php...fo&userid=3027
View this thread: http://www.excelforum.com/showthread.php?threadid=52961

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Searching one cell

this should work:

sheetname = ActiveSheet.Name
Worksheets(sheetname).Select
With ActiveCell
Set find_criteria = .Find(What:="<", Lookat:=xlPart, LookIn:=xlFormulas,
MatchCase:=False)
End With


"cbh35711" wrote:


So is there a way that i can search only one cell?
I can't really put in a specific range in like that, because i want it
to just be the active cell.

I've also tried
set rng = selection
and then trying range(rng), but that doesn't work either...

Any idea anyone?

Thanks

Chris


--
cbh35711
------------------------------------------------------------------------
cbh35711's Profile: http://www.excelforum.com/member.php...o&userid=30276
View this thread: http://www.excelforum.com/showthread...hreadid=529619


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
Searching, matching then searching another list based on the match A.S. Excel Discussion (Misc queries) 1 December 13th 06 05:08 AM
Cell searching and Replacing Graham Feeley Excel Discussion (Misc queries) 3 August 5th 05 04:42 PM
cell searching thephoenix12 Excel Discussion (Misc queries) 6 June 20th 05 04:44 PM
Searching a cell for a certain character. Matt Excel Worksheet Functions 3 January 3rd 05 09:14 PM
Searching for cell values Todd Excel Programming 1 August 21st 04 04:28 AM


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