0

I have below code to copy and paste from different sheets in workbook. I don't want to show the user different sheets opening and show only the sheet in which the action triggered (Interface).

How can I do it, any guidance?

Sheets("List").Select
Range("N2").Select

lastrow = Cells.Find("*", searchorder:=xlByRows, searchdirection:=xlPrevious).Row

Selection.AutoFill Destination:=Range("N2:N" & lastrow)

Range("O2").Select
Selection.AutoFill Destination:=Range("O2:O" & lastrow)

Range("O2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy

Sheets("Team Sports Pricelist").Select
Range("N5").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    
Sheets("Interface").Select
braX
  • 11,506
  • 5
  • 20
  • 33
Zuhal
  • 25
  • 5

1 Answers1

0

This is what your code might look like if you don't select anything. (Code isn't tested).

Dim Ws      As Worksheet
Dim Rng     As Range

Set Ws = Worksheets("List")
Set Rng = Ws.Range(Ws.Cells(2, "N"), Ws.Cells(Ws.Rows.Count, "N").End(xlUp))
Rng.Cells(1).AutoFill Destination:=Rng
Set Rng = Rng.Offset(0, 1)
Rng.Cells(1).AutoFill Destination:=Rng

Rng.Copy
Worksheets("Team Sports Pricelist").Range("N5").PasteSpecial xlPasteValues
Variatus
  • 14,293
  • 2
  • 14
  • 30