Need some help VBA-copy and paste

Buhocol

New Member
Joined
Jul 8, 2021
Messages
5
Office Version
  1. 365
Platform
  1. MacOS
Hi,

I am looking for someone to help me with a Macro-VBA for copy and paste information between sheets, as well as paste in the next available column, and finally to clear the content from the source data.

Source sheet: Data Entry
Destination sheet: Data Calculation
Same workbook

Source sheet copy I6:I101 and K6:K101
Destination sheet paste values only start in C8 first part and C111 second part.

Appreciate any help

Best,
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
You could try using the Macro Recorder for simple tasks like these, but try
VBA Code:
Sub MM1()
 With Sheets("Data Entry")
 .Range("I6:I101").Copy Sheets("Data Calculation").Range("C8")
 .Range("I6:I101").Clear
 .Range("K6:K101").Copy Sheets("Data Calculation").Range("C111")
 .Range("K6:K101").Clear
 End With
End Sub
 
Upvote 0
I tried but it showed me error most of the time. The part I really need help is to paste the information in the next available column. Reason I would like to save data daily

Thanks, but what about if I need to paste in sheet "Data Calculation" after the next available column.

Thanks again
 
Upvote 0
You could try using the Macro Recorder for simple tasks like these, but try
VBA Code:
Sub MM1()
 With Sheets("Data Entry")
 .Range("I6:I101").Copy Sheets("Data Calculation").Range("C8")
 .Range("I6:I101").Clear
 .Range("K6:K101").Copy Sheets("Data Calculation").Range("C111")
 .Range("K6:K101").Clear
 End With
End Sub
Thanks
You could try using the Macro Recorder for simple tasks like these, but try
VBA Code:
Sub MM1()
 With Sheets("Data Entry")
 .Range("I6:I101").Copy Sheets("Data Calculation").Range("C8")
 .Range("I6:I101").Clear
 .Range("K6:K101").Copy Sheets("Data Calculation").Range("C111")
 .Range("K6:K101").Clear
 End With
End Sub
I tried but it showed me error most of the time. The part I really need help is to paste the information in the next available column. Reason I would like to save data daily

Thanks, but what about if I need to paste in sheet "Data Calculation" after the next available column.

Thanks again
 
Upvote 0
This finds the last column in the "Data Calculation" Sheet
VBA Code:
Sub MM1()
Dim lc As Integer
lc = Sheets("Data Calculation").Cells.Find("*", , xlValues, , xlByColumns, xlPrevious).Column
 With Sheets("Data Entry")
 .Range("I6:I101").Copy Sheets("Data Calculation").Cells(8, lc + 1)
 .Range("I6:I101").Clear
 .Range("K6:K101").Copy Sheets("Data Calculation").Cells(111, lc + 1)
 .Range("K6:K101").Clear
 End With
End Sub
 
Upvote 0
This finds the last column in the "Data Calculation" Sheet
VBA Code:
Sub MM1()
Dim lc As Integer
lc = Sheets("Data Calculation").Cells.Find("*", , xlValues, , xlByColumns, xlPrevious).Column
 With Sheets("Data Entry")
 .Range("I6:I101").Copy Sheets("Data Calculation").Cells(8, lc + 1)
 .Range("I6:I101").Clear
 .Range("K6:K101").Copy Sheets("Data Calculation").Cells(111, lc + 1)
 .Range("K6:K101").Clear
 End With
End Sub
Thanks very much. Sorry to bother you, but do you mind to add the paste as values only in the code.

best,
 
Upvote 0

Forum statistics

Threads
1,215,051
Messages
6,122,872
Members
449,097
Latest member
dbomb1414

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