Code to merge cells

Roses8

Active Member
Joined
Aug 4, 2005
Messages
348
hi, Dont know how to start this please help!

IF column A = A/C number 5899 and 5898 and column C has an amount of -125 and -1300 then add the amounts together result in column C against 5899 and delete row 5898.

5898 -1300
5899 -125

result

5898 -1550

:)
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Hi, This what I have come up with the code below, but now im trying to say if cell = the codes below then code in to column 10 row 1 and so on but it debugs.


Sub TT()

Dim celltocopy As String



For i = 1 To Range("a65536").End(xlUp).Row
celltocopy = cells(i, 1).Value
If celltocopy = "AB089" And "AB090" Then
Range(cells(i, 1), cells(i, 4)).Select
Selection.Copy
cells(i, 10).Select
ActiveSheet.Paste
Else
End If
Next
i = i + 1
End Sub
 
Upvote 0
Try:

Code:
Sub TT()
Dim LastRow As Long, i As Long
Dim celltocopy As String

LastRow = Range("A65536").End(xlUp).Row

For i = 1 To LastRow
    celltocopy = Cells(i, 1).Value
    If celltocopy = "AB089" Or celltocopy = "AB090" Then
        Range(Cells(i, 1), Cells(i, 4)).Copy Destination:=Cells(i, 10)
    End If
Next i

End Sub
 
Upvote 0

Forum statistics

Threads
1,213,497
Messages
6,113,999
Members
448,543
Latest member
MartinLarkin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top