Below is an example - you just have to set the variables ahead of time - if you want to also change workbook just specify that ahead of the worksheet name(s)
If by selected values you mean cells highlighted (by the mosue) in your sheet then use the selection property - I am not sure exactly what you meanCode:SourceRangeVal = Split(Cells(1, ColumnFirst).Address, "$")(1) & FirstRecord & ":" & Split(Cells(1, ColumnLast).Address, "$")(1) & LastRecord DistinationRangeVal = Split(Cells(1, ColumnFirst).Address, "$")(1) & FirstRecord & ":" & Split(Cells(1, ColumnLast).Address, "$")(1) & LastRecord Worksheets("Sheet1").Range(SourceRangeVal).Copy Destination:=Worksheets("Sheet2").Range(DistinationRangeVal)







Reply With Quote

Bookmarks