amardeep_s
New Member
- Joined
- Aug 6, 2015
- Messages
- 7
hi All,
i am new to this forum and newbie to the Excel VBA. I am trying to complie simple loop VBA code to copy paste data until it finds empty cell. Code function properly however i want data to be pasted in Value format. Below is the code. Appreciate if anyone could help me with this.
Sub Macro_Loop()
Range("A2").Select
Do While ActiveCell.Value <> Empty
Range("A2", Range("B2").End(xlDown)).Copy Range("K2:L2")
ActiveCell.Offset(1, 0).Select
Loop
End Sub
Code that gives me error when i try to use paste value function:
Sub Macro_Loop()
Range("A2").Select
Do While ActiveCell.Value <> Empty
Range("A2", Range("B2").End(xlDown)).Select
Selection.Copy
Range("K2").Select
Selection.PasteSpecials :=xlPasteValues
ActiveCell.Offset(1, 0).Select
Loop
End Sub
i am new to this forum and newbie to the Excel VBA. I am trying to complie simple loop VBA code to copy paste data until it finds empty cell. Code function properly however i want data to be pasted in Value format. Below is the code. Appreciate if anyone could help me with this.
Sub Macro_Loop()
Range("A2").Select
Do While ActiveCell.Value <> Empty
Range("A2", Range("B2").End(xlDown)).Copy Range("K2:L2")
ActiveCell.Offset(1, 0).Select
Loop
End Sub
Code that gives me error when i try to use paste value function:
Sub Macro_Loop()
Range("A2").Select
Do While ActiveCell.Value <> Empty
Range("A2", Range("B2").End(xlDown)).Select
Selection.Copy
Range("K2").Select
Selection.PasteSpecials :=xlPasteValues
ActiveCell.Offset(1, 0).Select
Loop
End Sub