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
Hello,
This is Chakri, When im trying to put the macro conditions for the rows,i.e means in the table from range A1:D100 A1 ,B1,C1,D1 Cells have codes like ABC,DEF,GHI,JKL and the macro has to search for the condition in the table is there any cell in the same columns has same code ABC,DEF,GHI,JKL and then it should give the name in the F1 Cell as OKAY.
This is Chakri, When im trying to put the macro conditions for the rows,i.e means in the table from range A1:D100 A1 ,B1,C1,D1 Cells have codes like ABC,DEF,GHI,JKL and the macro has to search for the condition in the table is there any cell in the same columns has same code ABC,DEF,GHI,JKL and then it should give the name in the F1 Cell as OKAY.
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
- How to delete rows and columns in word - Guide
- Air condition lidl - Home - Apps & Sites
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