Conditional copy paste

Its_Prabhu

New Member
Joined
Sep 2, 2014
Messages
5
Hello All,

Need help to create a Macro. Column A has few names like, ABC, XYZ, so I need a macro if Column A has ABC, Column B should have a name: DDE and if its XYZ in Column A, Column B should have a name ADE. Also the number of rows varies weekly when a fresh dump is taken. Please help. Thanks !

Prabhu
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Try

Code:
Sub dtest()
Dim LR As Long, i As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
For i = 1 To LR
    With Range("A" & i)
        Select Case .Value
            Case "ABC": .Offset(, 1).Value = "DDE"
            Case "XYZ": .Offset(, 1).Value = "ADE"
        End Select
    End With
Next i
End Sub
 
Upvote 0
Hello VoG

Thanks for your quick response, I tried the below Code, Column B is blank. Maybe its because Column B is not mentioned anywhere in the Code. Please advise.

Thanks,

Prabhu
 
Upvote 0
Hi VoG,

Yes, working fine, my actual data is in Column J and N. Just modified and its perfect. Thanks very much.

Prabhu
 
Upvote 0

Forum statistics

Threads
1,214,872
Messages
6,122,025
Members
449,060
Latest member
LinusJE

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