Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
urgent help!find&press,please | Excel Discussion (Misc queries) | |||
Very Urgent - Find / Search Help Needed | Excel Discussion (Misc queries) | |||
How to find values in string? - Urgent! | Excel Discussion (Misc queries) | |||
Find first value in row + add following values (Please, Urgent) | Excel Discussion (Misc queries) | |||
URGENT! Find and delete row macro | Excel Programming |