View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Excel and VB6 Questions

You can reference a worksheet by its name:

Set xlSheet = xlBook.Worksheets("Sheet1")

You can copy a cell from one sheet to another with code like

Worksheets("Sheet1").Range("A1").Copy
destination:=Worksheets("Sheet2").Range("A1")


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Cen" wrote in message
oups.com...
Hi everyone, I need help with a couple things.

I need ot move data from a sheet in a spreadsheet to a new
sheet int he
same spreadsheet.

Is there a way to set an Excel.Worksheet object by name of the
sheet
and not the index?

i.e. instead of doing set xlSheet = xlBook.Worksheets(1), I
have the
name of the Sheet.

Secondly, how do I copy from one sheet to another?
Worksheets.FillAcrossSheets? Can anyone point to a good online
sample?

Thanks in advance for the help,
Cen