> You can actually use application.inputbox to get a range.
>
[quoted text clipped - 77 lines]
> > >
> > > David
This might get you started, but there's lots of things that pastespecial can
mean (values, formulas, formats???) and same with Appendbelow.
And with hardly any validation at all:
Option Explicit
Sub testme01()
Dim KeyWks As Worksheet
Dim testRngF As Range
Dim testRngT As Range
Dim myCell As Range
Dim myRng As Range
Dim myPasteSpecial As Boolean
Dim myPasteBelow As Boolean
Dim DestCell As Range
Dim myMsg As String
Set KeyWks = Worksheets("sheet1")
With KeyWks
Set myRng = .Range("a2", .Cells(.Rows.Count, "A").End(xlUp))
End With
For Each myCell In myRng.Cells
With myCell
Set testRngF = Nothing
Set testRngT = Nothing
On Error Resume Next
Set testRngF = Application.Range(.Value)
Set testRngT = Application.Range(.Offset(0, 1).Value)
On Error GoTo 0
myPasteSpecial = False
If LCase(.Offset(0, 2).Value) = "yes" Then
myPasteSpecial = True
End If
myPasteBelow = False
If LCase(.Offset(0, 3).Value) = "yes" Then
myPasteBelow = True
End If
If testRngF Is Nothing _
Or testRngT Is Nothing Then
myMsg = "Invalid Range(s)"
Else
Set DestCell = testRngT.Cells(1)
If myPasteBelow = True Then
If IsEmpty(DestCell) Then
'keep it here
ElseIf IsEmpty(DestCell.Offset(1, 0)) Then
Set DestCell = DestCell.Offset(1, 0)
Else
Set DestCell = DestCell.End(xlDown).Offset(1, 0)
End If
End If
If myPasteSpecial = True Then
testRngF.Copy
DestCell.PasteSpecial Paste:=xlPasteValues
myMsg = "PasteSpecial"
Else
testRngF.Copy _
Destination:=DestCell
myMsg = "just a paste"
End If
End If
.Offset(0, 4).Value = myMsg
End With
Next myCell
End Sub
But there are lots of things that you have to test for. Make sure that SrcRng
are single areas; maybe destrng's should be single cells???
> what I had in mind as that the user would set up a sheet in his workbook
> where he would enter the source and destination ranges into cells, like:
[quoted text clipped - 95 lines]
> >
> > Dave Peterson

Signature
Dave Peterson
DavidH - 23 Jan 2006 03:58 GMT
Dave,
Thanks. This is beginning to look like more than I bargained for, but I'm
going to give it a shot.
Thanks again for getting me started.
> This might get you started, but there's lots of things that pastespecial can
> mean (values, formulas, formats???) and same with Appendbelow.
[quoted text clipped - 171 lines]
> > >
> > > Dave Peterson