I am new to VBA I have a workbook with multiple worksheets 50+ I want to open a sheet and copy data from that sheet to another sheet, the code I have tried is:
Sub Copy_inventory()
Call Clear_Price_List
lastrow = Sheet11.Cells(Rows.count, 2).End(xlUp).Row
Dim rgSource As Range, rgDestination As Range
Set rgSource = Sheet11.Range("B2:E" & lastrow)
Set rgDestination = Sheet4.Range("C12")
rgSource.Copy
rgDestination.PasteSpecial xlPasteValues
End Sub
This works but i want change the sheet i have a cell on sheet 4 that has a lookup on it, when item is selected a vlookup returns the sheet coded name (Sheetx not the Caption)
I have tried replacing the Sheets with the cell value but doesnt work.
thank you in advance
Sub Copy_inventory()
Call Clear_Price_List
lastrow = Sheet11.Cells(Rows.count, 2).End(xlUp).Row
Dim rgSource As Range, rgDestination As Range
Set rgSource = Sheet11.Range("B2:E" & lastrow)
Set rgDestination = Sheet4.Range("C12")
rgSource.Copy
rgDestination.PasteSpecial xlPasteValues
End Sub
This works but i want change the sheet i have a cell on sheet 4 that has a lookup on it, when item is selected a vlookup returns the sheet coded name (Sheetx not the Caption)
I have tried replacing the Sheets with the cell value but doesnt work.
thank you in advance