- Joined
- Jun 15, 2012
- Messages
- 2
- Reaction score
- 0
Hi, I'm trying to write a function in which the user selects a cell in a worksheet, and the function stores that cell, moves to the previous worksheet, copies the data in the specified cell in THAT worksheet, and copies it back into the original worksheet. This is what I have so far:
Sub SameAsLast()
Dim rRange As Range
On Error Resume Next
Application.DisplayAlerts = False
Set rRange = Application.InputBox(Prompt:= _
"Please select a range with your mouse to be the recipient of the copied data.", _Title:="SPECIFY RANGE", Type:=8)
ActiveSheet.Previous.Select
rRange.Copy
ActiveSheet.Next.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
The thing screws up at rRange.Copy- I think it copies the info from the 1st sheet, when i want it to copy the info from the previous sheet.
I imagine this is a really dumb syntax thing. I'm also sure there's some extraneous code in there. Any help would be greatly appreciated.
Sub SameAsLast()
Dim rRange As Range
On Error Resume Next
Application.DisplayAlerts = False
Set rRange = Application.InputBox(Prompt:= _
"Please select a range with your mouse to be the recipient of the copied data.", _Title:="SPECIFY RANGE", Type:=8)
ActiveSheet.Previous.Select
rRange.Copy
ActiveSheet.Next.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
The thing screws up at rRange.Copy- I think it copies the info from the 1st sheet, when i want it to copy the info from the previous sheet.
I imagine this is a really dumb syntax thing. I'm also sure there's some extraneous code in there. Any help would be greatly appreciated.