copy and paste between xls files.. syntax problems

D

dr chuck

The following is used to select a range..

Windows("PanelSelect.xls").Activate
Sheets("Panel Construction").Select
Worksheets("Panel Construction").Range("A39:Ad55").Select
Selection.Copy

i then want to copy it to "s" which is an xls file name. ie
s=blahblahblah.xls. I have tried several convolusions.. and cant seem to find
the correct syntax.. not sure what the problem is.

Windows("s").Activate
Sheets("Sheet1").Select
Worksheets("Sheet1").Range("A1").Select
ActiveSheet.paste


bk.SaveAs "C:\Program Files\PanelSelect\panels\" & s
'renames the open workbook as "s"

Workbooks(s).Close SaveChanges:=True
'closes the man/lot/exp named xls file
************************************

very confused here...

the " s " is created this way...

Dim s As String, bk As Workbook

s = Range("othermanufact").Value & "-" & Range("lot").Value & "-" &
Format(Range("exp").Value, "mmddyyyy") & ".xls"
Set bk = Workbooks.Add()

very confused.. any help would be appreciated....
i am a novice.. so dont be shocked at my stupidity
dr chuck
 
D

Dave Peterson

See your earlier thread.

dr said:
The following is used to select a range..

Windows("PanelSelect.xls").Activate
Sheets("Panel Construction").Select
Worksheets("Panel Construction").Range("A39:Ad55").Select
Selection.Copy

i then want to copy it to "s" which is an xls file name. ie
s=blahblahblah.xls. I have tried several convolusions.. and cant seem to find
the correct syntax.. not sure what the problem is.

Windows("s").Activate
Sheets("Sheet1").Select
Worksheets("Sheet1").Range("A1").Select
ActiveSheet.paste

bk.SaveAs "C:\Program Files\PanelSelect\panels\" & s
'renames the open workbook as "s"

Workbooks(s).Close SaveChanges:=True
'closes the man/lot/exp named xls file
************************************

very confused here...

the " s " is created this way...

Dim s As String, bk As Workbook

s = Range("othermanufact").Value & "-" & Range("lot").Value & "-" &
Format(Range("exp").Value, "mmddyyyy") & ".xls"
Set bk = Workbooks.Add()

very confused.. any help would be appreciated....
i am a novice.. so dont be shocked at my stupidity
dr chuck
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top