![]() |
Find and write
Dear Prends, Is there any source code to see my problem below : If I find particular word (i,e word "TOTAL") from certain cell ("A") then write to next coulumn ("B") "Has been Found". I have hundreds like this in cell A Thanks Forks, TAHIR -- mtahir ------------------------------------------------------------------------ mtahir's Profile: http://www.excelforum.com/member.php...o&userid=25854 View this thread: http://www.excelforum.com/showthread...hreadid=392395 |
Find and write
Hi M,
Try the following minor adaptation of the example given in VBA help for the Find method: '========================= Sub TesterA() Dim c As Range Dim firstAddress As String With Worksheets(1).UsedRange '<<==== CHANGE? Set c = .Find(What:="Total", LookIn:=xlValues, LookAt:=xlPart) If Not c Is Nothing Then firstAddress = c.Address Do c.Offset(0, 1).Value = "Has been found" Set c = .FindNext(c) Loop While Not c Is Nothing And c.Address < firstAddress End If End With End Sub '<<=========================== Change Worksheets(1) to your worksheet name. Change UsedRange to the range to be searched. If the entire sheet is to be searched, leave this unchanged. --- Regards, Norman "mtahir" wrote in message ... Dear Prends, Is there any source code to see my problem below : If I find particular word (i,e word "TOTAL") from certain cell ("A") then write to next coulumn ("B") "Has been Found". I have hundreds like this in cell A Thanks Forks, TAHIR -- mtahir ------------------------------------------------------------------------ mtahir's Profile: http://www.excelforum.com/member.php...o&userid=25854 View this thread: http://www.excelforum.com/showthread...hreadid=392395 |
Find and write
Or in cell B1 enter formula =IF(ISERROR(FIND("TOTAL",A1)),"","Has Been
Found") and then copy down. Regards Rowan "mtahir" wrote: Dear Prends, Is there any source code to see my problem below : If I find particular word (i,e word "TOTAL") from certain cell ("A") then write to next coulumn ("B") "Has been Found". I have hundreds like this in cell A Thanks Forks, TAHIR -- mtahir ------------------------------------------------------------------------ mtahir's Profile: http://www.excelforum.com/member.php...o&userid=25854 View this thread: http://www.excelforum.com/showthread...hreadid=392395 |
Find and write
simplest solution is not a macro, but use Excel's own find function.
1) Enter this formula in the first row in B next to data in A, assuming starting at Row 2 (example) =IF(NOT(ISERR(FIND("TOTAL",A2))),"Has Been Found","") 2) Copy / Paste down 3) Copy Col B and use Edit - Paste Special - Values to replace with values 4) Use auto filter on column B with criteria being < "Has Been Found", if you want to group all the rows where that value was not found, to select and delete the empty string 5) Remove auto filter and you are left with the results you wished. This is better than writing a macro I think. wrote in message ... Dear Prends, Is there any source code to see my problem below : If I find particular word (i,e word "TOTAL") from certain cell ("A") then write to next coulumn ("B") "Has been Found". I have hundreds like this in cell A Thanks Forks, TAHIR -- mtahir ------------------------------------------------------------------------ mtahir's Profile: http://www.excelforum.com/member.php...o&userid=25854 View this thread: http://www.excelforum.com/showthread...hreadid=392395 |
Find and write
Hi Bill,
This is better than writing a macro I think. Possibly, but very little writing is involved; with but minor amendment, the procedure is lifted straight from VBA help. --- Regards, Norman "William Benson" wrote in message ... simplest solution is not a macro, but use Excel's own find function. 1) Enter this formula in the first row in B next to data in A, assuming starting at Row 2 (example) =IF(NOT(ISERR(FIND("TOTAL",A2))),"Has Been Found","") 2) Copy / Paste down 3) Copy Col B and use Edit - Paste Special - Values to replace with values 4) Use auto filter on column B with criteria being < "Has Been Found", if you want to group all the rows where that value was not found, to select and delete the empty string 5) Remove auto filter and you are left with the results you wished. This is better than writing a macro I think. wrote in message ... Dear Prends, Is there any source code to see my problem below : If I find particular word (i,e word "TOTAL") from certain cell ("A") then write to next coulumn ("B") "Has been Found". I have hundreds like this in cell A Thanks Forks, TAHIR -- mtahir ------------------------------------------------------------------------ mtahir's Profile: http://www.excelforum.com/member.php...o&userid=25854 View this thread: http://www.excelforum.com/showthread...hreadid=392395 |
Find and write
Hi Norman, You are the men....... thank. Unfort... I just find only in cell A (not all cell in worksheet) pls advice Trims, Tahir -- mtahir ------------------------------------------------------------------------ mtahir's Profile: http://www.excelforum.com/member.php...o&userid=25854 View this thread: http://www.excelforum.com/showthread...hreadid=392395 |
Find and write
Sub TesterA()
Dim c As Range Dim firstAddress As String With Worksheets(1).Columns(1) Set c = .Find(What:="Total", LookIn:=xlValues, LookAt:=xlPart) If Not c Is Nothing Then firstAddress = c.Address Do c.Offset(0, 1).Value = "Has been found" Set c = .FindNext(c) Loop While Not c Is Nothing And c.Address < firstAddress End If End With End Sub -- Regards, Tom Ogilvy "mtahir" wrote in message ... Hi Norman, You are the men....... thank. Unfort... I just find only in cell A (not all cell in worksheet) pls advice Trims, Tahir -- mtahir ------------------------------------------------------------------------ mtahir's Profile: http://www.excelforum.com/member.php...o&userid=25854 View this thread: http://www.excelforum.com/showthread...hreadid=392395 |
Find and write
I am sure Norman, however at the end of the day learning basic spreadsheet
skills (I would have been done with the above in under 30 seconds GUARANTEED) some one-off issues of this simple nature are better handled through solid spreadsheeting skills than macro writing. It's just my humble opinion, I did not say the macro was complicated. So I am glad if Tom or you were able to help Tahir with a macro. Bill "Norman Jones" wrote in message ... Hi Bill, This is better than writing a macro I think. Possibly, but very little writing is involved; with but minor amendment, the procedure is lifted straight from VBA help. --- Regards, Norman "William Benson" wrote in message ... simplest solution is not a macro, but use Excel's own find function. 1) Enter this formula in the first row in B next to data in A, assuming starting at Row 2 (example) =IF(NOT(ISERR(FIND("TOTAL",A2))),"Has Been Found","") 2) Copy / Paste down 3) Copy Col B and use Edit - Paste Special - Values to replace with values 4) Use auto filter on column B with criteria being < "Has Been Found", if you want to group all the rows where that value was not found, to select and delete the empty string 5) Remove auto filter and you are left with the results you wished. This is better than writing a macro I think. wrote in message ... Dear Prends, Is there any source code to see my problem below : If I find particular word (i,e word "TOTAL") from certain cell ("A") then write to next coulumn ("B") "Has been Found". I have hundreds like this in cell A Thanks Forks, TAHIR -- mtahir ------------------------------------------------------------------------ mtahir's Profile: http://www.excelforum.com/member.php...o&userid=25854 View this thread: http://www.excelforum.com/showthread...hreadid=392395 |
Find and write
thanks again, why cant run if I change With BAS(1).Columns(1) <========== Worksheets(1).Columns(1) BAS is my worksheet name Many thanks, Tahir -- mtahir ------------------------------------------------------------------------ mtahir's Profile: http://www.excelforum.com/member.php...o&userid=25854 View this thread: http://www.excelforum.com/showthread...hreadid=392395 |
Find and write
Hi Tahir,
Try: Sub TesterA() Dim c As Range Dim firstAddress As String With Worksheets("Bas").Columns(1) Set c = .Find(What:="Total", LookIn:=xlValues, LookAt:=xlPart) If Not c Is Nothing Then firstAddress = c.Address Do c.Offset(0, 1).Value = "Has been found" Set c = .FindNext(c) Loop While Not c Is Nothing And c.Address < firstAddress End If End With End Sub --- Regards, Norman "mtahir" wrote in message ... thanks again, why cant run if I change With BAS(1).Columns(1) <========== Worksheets(1).Columns(1) BAS is my worksheet name Many thanks, Tahir -- mtahir ------------------------------------------------------------------------ mtahir's Profile: http://www.excelforum.com/member.php...o&userid=25854 View this thread: http://www.excelforum.com/showthread...hreadid=392395 |
Find and write
Hi Bill,
There is much in what you say and my response might well have differed had the question been posed elsewhere. This is, however, a programming group, and if a simple code solution is availablle, I have little problem of conscience in suggesting it. A laudible aspect of this group, is the willingnes to offer a variety of solution approaches. When you, or others, advocate approaches or ideas that differ from those that I might have suggested, I regard that as not only useful to the OP but as a potential source of imstruction and education for me. So Bill, the more often you post an alternative, better solution, the happier I shall be! Please continue to make me happy! --- Regards, Norman "William Benson" wrote in message ... I am sure Norman, however at the end of the day learning basic spreadsheet skills (I would have been done with the above in under 30 seconds GUARANTEED) some one-off issues of this simple nature are better handled through solid spreadsheeting skills than macro writing. It's just my humble opinion, I did not say the macro was complicated. So I am glad if Tom or you were able to help Tahir with a macro. Bill "Norman Jones" wrote in message ... Hi Bill, This is better than writing a macro I think. Possibly, but very little writing is involved; with but minor amendment, the procedure is lifted straight from VBA help. --- Regards, Norman "William Benson" wrote in message ... simplest solution is not a macro, but use Excel's own find function. 1) Enter this formula in the first row in B next to data in A, assuming starting at Row 2 (example) =IF(NOT(ISERR(FIND("TOTAL",A2))),"Has Been Found","") 2) Copy / Paste down 3) Copy Col B and use Edit - Paste Special - Values to replace with values 4) Use auto filter on column B with criteria being < "Has Been Found", if you want to group all the rows where that value was not found, to select and delete the empty string 5) Remove auto filter and you are left with the results you wished. This is better than writing a macro I think. wrote in message ... Dear Prends, Is there any source code to see my problem below : If I find particular word (i,e word "TOTAL") from certain cell ("A") then write to next coulumn ("B") "Has been Found". I have hundreds like this in cell A Thanks Forks, TAHIR -- mtahir ------------------------------------------------------------------------ mtahir's Profile: http://www.excelforum.com/member.php...o&userid=25854 View this thread: http://www.excelforum.com/showthread...hreadid=392395 |
Find and write
Very nicely expressed.
Yes, it is a programming group, I need to bear that in mind more than I do. "Norman Jones" wrote in message ... Hi Bill, There is much in what you say and my response might well have differed had the question been posed elsewhere. This is, however, a programming group, and if a simple code solution is availablle, I have little problem of conscience in suggesting it. A laudible aspect of this group, is the willingnes to offer a variety of solution approaches. When you, or others, advocate approaches or ideas that differ from those that I might have suggested, I regard that as not only useful to the OP but as a potential source of imstruction and education for me. So Bill, the more often you post an alternative, better solution, the happier I shall be! Please continue to make me happy! --- Regards, Norman "William Benson" wrote in message ... I am sure Norman, however at the end of the day learning basic spreadsheet skills (I would have been done with the above in under 30 seconds GUARANTEED) some one-off issues of this simple nature are better handled through solid spreadsheeting skills than macro writing. It's just my humble opinion, I did not say the macro was complicated. So I am glad if Tom or you were able to help Tahir with a macro. Bill "Norman Jones" wrote in message ... Hi Bill, This is better than writing a macro I think. Possibly, but very little writing is involved; with but minor amendment, the procedure is lifted straight from VBA help. --- Regards, Norman "William Benson" wrote in message ... simplest solution is not a macro, but use Excel's own find function. 1) Enter this formula in the first row in B next to data in A, assuming starting at Row 2 (example) =IF(NOT(ISERR(FIND("TOTAL",A2))),"Has Been Found","") 2) Copy / Paste down 3) Copy Col B and use Edit - Paste Special - Values to replace with values 4) Use auto filter on column B with criteria being < "Has Been Found", if you want to group all the rows where that value was not found, to select and delete the empty string 5) Remove auto filter and you are left with the results you wished. This is better than writing a macro I think. wrote in message ... Dear Prends, Is there any source code to see my problem below : If I find particular word (i,e word "TOTAL") from certain cell ("A") then write to next coulumn ("B") "Has been Found". I have hundreds like this in cell A Thanks Forks, TAHIR -- mtahir ------------------------------------------------------------------------ mtahir's Profile: http://www.excelforum.com/member.php...o&userid=25854 View this thread: http://www.excelforum.com/showthread...hreadid=392395 |
All times are GMT +1. The time now is 10:56 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com