Caveman1964
Board Regular
- Joined
- Dec 14, 2017
- Messages
- 127
- Office Version
- 2016
- Platform
- Windows
I named 4 different sections of cells as a range name,
specifically sheet 2 a1:a5, a10:a15 and a20:a25. named it "split"
I wanted to copy paste into same range on sheet 1 and named it "splittgt"
It gets all the way to paste then gives me this error.
"This action wont work on multiple selections"
Here is code, I have been working with this for an hour with no luck. I will continue to attempt to figure it out but would appreciate and be grateful for any help.
I am not real good with VBA.
Sub Rectangle2_Click()
Dim lastrow As Long
Dim split As Range
Dim splittgt As Range
Dim wb As Workbook
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Set ws1 = Sheets("sheet1")
Set ws2 = Sheets("sheet2")
Set wb = ThisWorkbook
Set split = ws2.Range("split")
Set splittgt = ws1.Range("splittgt")
split.Copy
splittgt.PasteSpecial Paste:=xlPasteValues
End Sub
specifically sheet 2 a1:a5, a10:a15 and a20:a25. named it "split"
I wanted to copy paste into same range on sheet 1 and named it "splittgt"
It gets all the way to paste then gives me this error.
"This action wont work on multiple selections"
Here is code, I have been working with this for an hour with no luck. I will continue to attempt to figure it out but would appreciate and be grateful for any help.
I am not real good with VBA.
Sub Rectangle2_Click()
Dim lastrow As Long
Dim split As Range
Dim splittgt As Range
Dim wb As Workbook
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Set ws1 = Sheets("sheet1")
Set ws2 = Sheets("sheet2")
Set wb = ThisWorkbook
Set split = ws2.Range("split")
Set splittgt = ws1.Range("splittgt")
split.Copy
splittgt.PasteSpecial Paste:=xlPasteValues
End Sub