unknownymous
Board Regular
- Joined
- Sep 19, 2017
- Messages
- 249
- Office Version
- 2016
- Platform
- Windows
Hi Gurus,
Good day!
I just wanted to ask for your insight as I found a code to merge accounts, however if the cell data is not the same, it will skip the code.
Example:
'VBA Code for Merging the Data 1 and Data 2
Dim i As Long
'Row Selection
Rows("2:3").Select
' Go or Ignore
For i = 3 To Selection.Columns.Count
Selection.Cells(1, i) = Selection.Cells(1, i) + Selection.Cells(2, i)
Next i
Selection.Cells(2, 1).EntireRow.Delete Shift:=xlUp
End Sub
= = = =
In the initial code, I think I need to check first if cell B2 & B3 are both "Math". If yes, the code will push through but if the cell text is different then ignore .
Appreciate the help.
Good day!
I just wanted to ask for your insight as I found a code to merge accounts, however if the cell data is not the same, it will skip the code.
Example:
No | Name | Data 1 | Data 2 |
001 | Math | 100 | 95 |
002 | Math | 100 | 95 |
003 | Science | 95 | 90 |
'VBA Code for Merging the Data 1 and Data 2
Dim i As Long
'Row Selection
Rows("2:3").Select
' Go or Ignore
For i = 3 To Selection.Columns.Count
Selection.Cells(1, i) = Selection.Cells(1, i) + Selection.Cells(2, i)
Next i
Selection.Cells(2, 1).EntireRow.Delete Shift:=xlUp
End Sub
= = = =
In the initial code, I think I need to check first if cell B2 & B3 are both "Math". If yes, the code will push through but if the cell text is different then ignore .
Appreciate the help.