VBA PROGRAMME REQUIRED FOR COPY PASTE SPECIAL

Abhi07

New Member
Joined
Feb 16, 2024
Messages
1
Office Version
  1. 2021
  2. 2019
Platform
  1. Windows
Hi


VBA PROGRAMME REQUIRED TO PERFORM BELOW TASKS;

  1. COPY DATA FROM THE COLUMNS (CG) AND PASTE INTO MERGED COLUMN (CP,CQ,CR)
  2. COPY DATA FROM THE COLUMNS (CH) AND PASTE INTO MERGED COLUMN (CS, CT, CU, CV)
  3. COPY DATA FROM THE COLUMNS (CI, CJ, CK, CL), CONCATENATE (JOIN) IN COLUMN WITH LINE BREAK (ENTER) BETWEEN DATA THEN PASTE INTO MERGED COLUMN (CW, CX, CY, CZ, DA, DB, DC, DD)

NOTE THAT THESE COLUMNS ARE MERGED, THIS IS TO ENABLE EASY COPY/PASTE INTO ANOTHER EXCEL. DATA SHOWN ABOVE IS IN SINGLE ROW, HOWEVER IN ACTUAL IT MAY BE MORE THAN 9000 ROWS.
 

Attachments

  • SAMPLE PHOTO.jpg
    SAMPLE PHOTO.jpg
    162.1 KB · Views: 5

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
This macro assumes you have headers in row 1 and your data starts in row 2.
VBA Code:
Sub CopyData()
    Application.ScreenUpdating = False
    Dim v As Variant, i As Long
    v = Range("CG2", Range("CG" & Rows.Count).End(xlUp)).Resize(, 6).Value
    For i = LBound(v) To UBound(v)
        Range("CP" & i + 1) = v(i, 1)
        Range("CS" & i + 1) = v(i, 2)
        Range("CW" & i + 1) = Join(Application.Transpose(Application.Transpose(Array(v(i, 3), v(i, 4), v(i, 5), v(i, 6)))), Chr(10))
        Rows(i + 1).RowHeight = Rows(i + 1).RowHeight + 45
    Next i
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,223,246
Messages
6,170,988
Members
452,373
Latest member
TimReeks

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