Copy of column content by line range.

Allan20

New Member
Joined
Jan 24, 2023
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Good morning everyone.

You currently have a report where I must perform data repairs. In question, a copy and paste of data in specific columns through a specific line.

graphically it is this.


Animation.gif


(https://i.ibb.co/FH8RmvZ/Animation.gif)

Column A shows the line where I must carry out the repair, and column B shows the data to be changed. So it would be in the first case: column A with value 3, column B with value ANTONIO FIX. It affects line 3 and would copy the value from column A to column F

The problem is that the report consists of about 20,000 lines.

What I want to know is if a macro can be made where it takes the total range of column A (where the line to be modified is marked) and through this it would change the value of column F.


Record Macro

Sub Lines()
'
' Lines Macro
'

'
Selection.Copy
Range("F3").Select
ActiveSheet.Paste
Range("B2").Select
Application.CutCopyMode = False
Selection.Copy
Range("F4").Select
ActiveSheet.Paste
Range("B3").Select
Application.CutCopyMode = False
Selection.Copy
Range("F4").Select
ActiveSheet.Paste
End Sub




Thanks.


3​
ANTONIO FIX1xxxxxxxxxxxxxANTONIOxxxxxxxxxxxxxxxxxx
4​
MANUEL FIX1xxxxxxxxxxxxxMANUELxxxxxxxxxxxxxxxxxx
6​
JOSE FIX1xxxxxxxxxxxxxJOSE FIXxxxxxxxxxxxxxxxxxx
21​
FRANCISCO FIX1xxxxxxxxxxxxxJOSE FIXxxxxxxxxxxxxxxxxxx
23​
DAVID FIX1xxxxxxxxxxxxxDAVIDxxxxxxxxxxxxxxxxxx
24​
JUAN FIX1xxxxxxxxxxxxxJOSE FIXxxxxxxxxxxxxxxxxxx
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Try this
VBA Code:
Sub Copy()
        Dim lr As Long
        lr = Range("A" & Rows.Count).End(xlUp).Row
        Dim k As Long
       
        For k = 1 To lr
                Range("B" & k).Copy Range("F" & CLng(Range("A" & k)))
        Next k
               
End Sub
 

Attachments

  • 1674583028301.png
    1674583028301.png
    28.6 KB · Views: 7
Upvote 0
Solution

Forum statistics

Threads
1,223,893
Messages
6,175,239
Members
452,621
Latest member
Laura_PinksBTHFT

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