Macro for Rows condition
Closed
Chakri
-
Nov 29, 2010 at 08:21 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Nov 29, 2010 at 09:16 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Nov 29, 2010 at 09:16 AM
Related:
- Macro for Rows condition
- Spell number in excel without macro - Guide
- Macro excel download - Download - Spreadsheets
- Excel macro to create new sheet based on value in cells - Guide
- Air condition lidl - Home - Apps & Sites
- If condition in excel - Guide
1 response
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Nov 29, 2010 at 09:16 AM
Nov 29, 2010 at 09:16 AM
Hi Chakri,
What I understand from your query is that:
For range A2:A100 find text "ABC", when found add text "OKAY" in F1.
For range B2:B100 find text "DEF", when found add text "OKAY" in F1.
For range C2:C100 find text "GHI", when found add text "OKAY" in F1.
For range D2:D100 find text "JKL", when found add text "OKAY" in F1.
When nothing is found do nothing.
Use the following code to do the above:
Did I understood you correctly?
Best regards,
Trowa
What I understand from your query is that:
For range A2:A100 find text "ABC", when found add text "OKAY" in F1.
For range B2:B100 find text "DEF", when found add text "OKAY" in F1.
For range C2:C100 find text "GHI", when found add text "OKAY" in F1.
For range D2:D100 find text "JKL", when found add text "OKAY" in F1.
When nothing is found do nothing.
Use the following code to do the above:
Sub test() Set MRA = Range("A2:A100") Set MRB = Range("B2:B100") Set MRC = Range("C2:C100") Set MRD = Range("D2:D100") For Each cell In MRA If cell.Value = "ABC" Then Range("F1").Value = "OKAY" Next For Each cell In MRB If cell.Value = "DEF" Then Range("F1").Value = "OKAY" Next For Each cell In MRC If cell.Value = "GHI" Then Range("F1").Value = "OKAY" Next For Each cell In MRD If cell.Value = "JKL" Then Range("F1").Value = "OKAY" Next End Sub
Did I understood you correctly?
Best regards,
Trowa