View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Macro to extract data and paste to a new sheet

Hi Les,

I know my way around Excel but I'm afraid I'm still getting used to VB.
Could you tell me what is being said in the 'Set' lines of code where you
are saying 'change'.



Set WB = ActiveWorkbook '<<===== CHANGE


If the code is to operate on the active workbook, no change is required. If
the code is to operate on the workbook holding the code, change this line
to:

Set WB = ThisWorkbook

If, the code is to operate on another workbook, you will need to provide the
name, e.g.:

Set WB = Workbooks("Les.xls")

where Les.xls is the name of the workbook of interest.

Set destsh = WB.Sheets("Sheet2") '<<===== CHANGE


Replace Sheet2 with the name of the sheet which is to receive the copied
data.


Set destrng = destsh.Range("A1") '<<===== CHANGE


ReplaceA1 with the address of the first cell of the destination range for
the copied data.


---
Regards,
Norman


"Les" wrote in message
...
Hi Norman
Thanks for the help and the very quick response.
I know my way around Excel but I'm afraid I'm still getting used to VB.
Could you tell me what is being said in the 'Set' lines of code where you
are saying 'change'.
Thanks
Les.