Modify macro to select specific cells and copy them to specific cells in another sheet

caligirl626

New Member
Joined
Nov 28, 2022
Messages
24
Office Version
  1. 365
Platform
  1. Windows
Have a workbook with many sheets that logs work orders per project (each sheet is a different project). The first sheet called "Project" is the main log that tracks all the work orders.
I need a macro that copies the contents of cell columns A,B,C of a project sheet where the selection has been set to column A, and copies those A,B,C contents into to the "Project" sheet columns D,E,F of the next empty row.

For example, cell A11 is selected in project sheet "6402-01" (capture1.png). When the macro is activated, it copies A11, B11, C11 and pastes them into the "Project" sheet cells D2266, E2266, F2266 because that was the next empty row of the "Project" sheet" (capture2.png).

This code does the request, but only for certain cells. Need it a bit smarter.

VBA Code:
Sub Macro6()
'
' Macro6 Macro
'

'
    Range("A11:C11").Select
    Selection.Copy
    Sheets("Project").Select
    Range("D2266").Select
    ActiveSheet.Paste
End Sub
 

Attachments

  • Capture1.PNG
    Capture1.PNG
    38.3 KB · Views: 13
  • Capture2.PNG
    Capture2.PNG
    23.8 KB · Views: 13

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Forum statistics

Threads
1,223,902
Messages
6,175,278
Members
452,629
Latest member
SahilPolekar

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