Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default find next? urgent


i need a VBA function that finds the first instance of "a" in
worksheet, performs an operation on it, then does the same for the nex
instance of "a", until the term is no longer found

thnx al

--
cwatso
-----------------------------------------------------------------------
cwatson's Profile: http://www.excelforum.com/member.php...fo&userid=2460
View this thread: http://www.excelforum.com/showthread.php?threadid=38286

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default find next? urgent


heres what i have so far

Code:
--------------------
Sheets("list").Select
Cells.Find(What:="A-s", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
Application.Run "achip.xls!rawdata"
--------------------


and the paramenter to find next:

Code:
--------------------
Cells.FindNext(After:=ActiveCell).Activate
--------------------


i need to run the first code snippet, then run the second code snippet,
then the first..untill the last occupied column.

:)


--
cwatson
------------------------------------------------------------------------
cwatson's Profile: http://www.excelforum.com/member.php...o&userid=24608
View this thread: http://www.excelforum.com/showthread...hreadid=382865

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default find next? urgent


Backup the workbook before trying this macro.

I am not sure what you doing using Application.Run "achip.xls!rawdata"

Sub macro()
Dim init_adr As Variant
Sheets("list").Select
Cells.Find(What:="A-s", After:=ActiveCell, LookIn:=xlValues
LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext
MatchCase:=False _
, SearchFormat:=False).Activate
init_adr = ActiveCell.Address
Application.Run "achip.xls!rawdata"
While i = 0

Cells.FindNext(After:=ActiveCell).Activate
If ActiveCell.Address < init_adr Then
Application.Run "achip.xls!rawdata"
Else
i = 1
End If

Wend
End Su

--
anilsolipura
-----------------------------------------------------------------------
anilsolipuram's Profile: http://www.excelforum.com/member.php...fo&userid=1627
View this thread: http://www.excelforum.com/showthread.php?threadid=38286

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default find next? urgent


thank you, i will try that

!rawdata is the operation that needs to be ran on every instance of
"A-s"

rawdata
Code:
--------------------

Sub rawdata()
'
' rawdata Macro
' create raw data based on chips
'
' Keyboard Shortcut: Ctrl+y
'
b = "A"
ActiveCell.Select
a = ActiveCell.Text
Sheets(CStr(b)).Select
Find_Range(CStr(a), Range("A1:DZ1")).Select

Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
c = "final" + CStr(b)
Sheets(CStr(c)).Paste
Sheets(CStr(c)).Select
ActiveCell.EntireColumn.End(xlUp).Offset(0, 3).Select
Sheets("list").Select

End Sub
--------------------


find_range is another find function


--
cwatson
------------------------------------------------------------------------
cwatson's Profile: http://www.excelforum.com/member.php...o&userid=24608
View this thread: http://www.excelforum.com/showthread...hreadid=382865

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default find next? urgent


your macro completed the operation then found the next cell, it needs t
repeat the operation of every cell found until it finds no mor

--
cwatso
-----------------------------------------------------------------------
cwatson's Profile: http://www.excelforum.com/member.php...fo&userid=2460
View this thread: http://www.excelforum.com/showthread.php?threadid=38286



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default find next? urgent


Function Find_Range(Find_Item As Variant, _
Search_Range As Range, _
Optional LookIn As Variant, _
Optional LookAt As Variant, _
Optional MatchCase As Boolean) As Range

Dim c As Range
If IsMissing(LookIn) Then LookIn = xlValues 'xlFormulas
If IsMissing(LookAt) Then LookAt = xlPart 'xlWhole
If IsMissing(MatchCase) Then MatchCase = False

With Search_Range
Set c = .Find( _
What:=Find_Item, _
LookIn:=LookIn, _
LookAt:=LookAt, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=MatchCase, _
SearchFormat:=False)
If Not c Is Nothing Then
Set Find_Range = c
firstAddress = c.Address
Do
Set Find_Range = Union(Find_Range, c)
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With

End Functio

--
cwatso
-----------------------------------------------------------------------
cwatson's Profile: http://www.excelforum.com/member.php...fo&userid=2460
View this thread: http://www.excelforum.com/showthread.php?threadid=38286

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default find next? urgent


wee! i got it:
thnx for all ur help and effort

Code
-------------------

Sub foreachA()
Sheets("list").Select
Find_Range("A-s", Cells).Select

Dim cell As Object
Dim count As Integer
count = 0
For Each cell In Selection
count = count + 1
Next cell
cnt = count



For x = 1 To CStr(cnt)
Sheets("list").Select
Cells.Find(What:="A-s", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
Application.Run "achip.xls!rawdata"
Sheets("list").Select
Cells.FindNext(After:=ActiveCell).Activate
Next x



End Sub

-------------------

--
cwatso
-----------------------------------------------------------------------
cwatson's Profile: http://www.excelforum.com/member.php...fo&userid=2460
View this thread: http://www.excelforum.com/showthread.php?threadid=38286

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
urgent help!find&press,please Alex Excel Discussion (Misc queries) 0 February 18th 10 11:37 AM
Very Urgent - Find / Search Help Needed TGV Excel Discussion (Misc queries) 8 June 28th 09 03:00 PM
How to find values in string? - Urgent! [email protected] Excel Discussion (Misc queries) 6 September 15th 06 02:12 PM
Find first value in row + add following values (Please, Urgent) Evgeny Excel Discussion (Misc queries) 5 March 15th 06 06:50 PM
URGENT! Find and delete row macro newmand2[_3_] Excel Programming 2 May 4th 04 05:47 PM


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

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"