Trying to simply copy ranges of text from sheet 1 to sheet 2. I don't want specific data ranges for the paste as I simply want to reuse the data to rotate assigned tasks (sheet 1) to apply to days/workers (sheet 2).
I started with a "record macro" that did not work then using this forum and several other sources ended up with this:
Sub rotationA()
Sheets("Sheet1").Range("B2:B5").Copy
Sheets("Sheet2").Select
Selection.Insert Shift:=xlDown
End Sub
the line --- Sheets("sheet1").Range("B2:B5").copy indicates error. I am very new to vb and have rewritten the line a number of ways with no success. The answers to other's question don't show the code being used in a manner that looks the same to me and I need help understanding this.
Any help is appreciated!
You are not selecting a range to paste into only a sheet. Try changing your code to the below:
Sub rotationA()
Sheets("Sheet1").Range("B2:B5").Copy
Sheets("Sheet2").Range("B2").PasteSpecial
End Sub
This will paste into cell B2 on Sheet2 - change the
Range("B2")
portion of the second line to the cell you wish to paste into.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.