Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Export selected Sheet in a new workbook with old workbook name!

Hi,

I have a workbook with 3 sheets in it. middle sheet has table of values,
which i want to export as a new workbook having only 1 sheet(that sheet) &
this new workbook must be named as old workbook & sheet should have just the
table formats & values, no Formulas.

Also, wanted to add, if there is a way to export new worksheet as new
workbook, with old name & delete the old workbook simultaneously, to save
space in hard-disk.

Any help would be most appreciated!

Rgds,

Eijaz



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Export selected Sheet in a new workbook with old workbook name!

Hi,

Once Again, I'll Explain:

From,
OldWorkbook (named Eijaz) - 3 sheets
Create,
New Workbook (named Eijaz&Now()) - 2nd sheet of OldWorkbook(named as say
"Sept", found in Cell "A1" on sheet)
Once Created,
Delete OldWorkbook (optional)

Rgds,

Eijaz



"gr8guy" wrote in message
...
Hi,

I have a workbook with 3 sheets in it. middle sheet has table of values,
which i want to export as a new workbook having only 1 sheet(that sheet) &
this new workbook must be named as old workbook & sheet should have just

the
table formats & values, no Formulas.

Also, wanted to add, if there is a way to export new worksheet as new
workbook, with old name & delete the old workbook simultaneously, to save
space in hard-disk.

Any help would be most appreciated!

Rgds,

Eijaz





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Export selected Sheet in a new workbook with old workbook name!

Hi Dave,

First Because, I have a lot of workbooks, & second because I will be
attaching this code to a button on sheet3, Old workbook, for every old
workbooks.

Please note that the Delete idea is optional. Just Wanted to know if it can
be done!

Rgds,

Eijaz


"Dave Peterson" wrote in message
...
Why not just delete the other sheets
select all the cells
edit|copy
edit|paste special|values
and save it as the original name.



gr8guy wrote:

Hi,

Once Again, I'll Explain:

From,
OldWorkbook (named Eijaz) - 3 sheets
Create,
New Workbook (named Eijaz&Now()) - 2nd sheet of OldWorkbook(named as say
"Sept", found in Cell "A1" on sheet)
Once Created,
Delete OldWorkbook (optional)

Rgds,

Eijaz

"gr8guy" wrote in message
...
Hi,

I have a workbook with 3 sheets in it. middle sheet has table of

values,
which i want to export as a new workbook having only 1 sheet(that

sheet) &
this new workbook must be named as old workbook & sheet should have

just
the
table formats & values, no Formulas.

Also, wanted to add, if there is a way to export new worksheet as new
workbook, with old name & delete the old workbook simultaneously, to

save
space in hard-disk.

Any help would be most appreciated!

Rgds,

Eijaz




--

Dave Peterson



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Export selected Sheet in a new workbook with old workbook name!

Thanks Dave,


Rgds,

Eijaz


"Dave Peterson" wrote in message
...
Yeah, I think it's possible.

But I would be hesitant to do this. By destroying the old workbook, don't

you
lose the abililty to go back and just double check that things worked.

(I'm
always afraid that something will go wrong and the data will be lost

forever.)

But if you really want, this seemed to work ok for me:

Option Explicit
Sub testme()

Dim keepWks As Worksheet
Dim NameToUse As String

Set keepWks = ThisWorkbook.Worksheets("sheet2")
NameToUse = ThisWorkbook.FullName

keepWks.Copy 'to a new workbook
Set keepWks = ActiveSheet 'in the new workbook

With keepWks
.UsedRange.Value = .UsedRange.Value
.Name = .Range("a1").Value
End With

Application.DisplayAlerts = False
ThisWorkbook.SaveAs Filename:=Environ("temp") & "\deletemelater.xls"
Application.DisplayAlerts = True

Application.DisplayAlerts = False
keepWks.Parent.SaveAs Filename:=NameToUse
Application.DisplayAlerts = True

ThisWorkbook.Saved = True
ThisWorkbook.ChangeFileAccess xlReadOnly
Kill ThisWorkbook.FullName

ThisWorkbook.Close savechanges:=False

End Sub

I didn't do any validation. I expect that the value in A1 represents a

valid
worksheet name.

If I were testing this, I'd comment out that Kill statement. If things

didn't
work ok, then go to your windows temp folder and move deletemelater.xls to

a
nice spot to save the data.



gr8guy wrote:

Hi Dave,

First Because, I have a lot of workbooks, & second because I will be
attaching this code to a button on sheet3, Old workbook, for every old
workbooks.

Please note that the Delete idea is optional. Just Wanted to know if it

can
be done!

Rgds,

Eijaz

"Dave Peterson" wrote in message
...
Why not just delete the other sheets
select all the cells
edit|copy
edit|paste special|values
and save it as the original name.



gr8guy wrote:

Hi,

Once Again, I'll Explain:

From,
OldWorkbook (named Eijaz) - 3 sheets
Create,
New Workbook (named Eijaz&Now()) - 2nd sheet of OldWorkbook(named as

say
"Sept", found in Cell "A1" on sheet)
Once Created,
Delete OldWorkbook (optional)

Rgds,

Eijaz

"gr8guy" wrote in message
...
Hi,

I have a workbook with 3 sheets in it. middle sheet has table of

values,
which i want to export as a new workbook having only 1 sheet(that

sheet) &
this new workbook must be named as old workbook & sheet should

have
just
the
table formats & values, no Formulas.

Also, wanted to add, if there is a way to export new worksheet as

new
workbook, with old name & delete the old workbook simultaneously,

to
save
space in hard-disk.

Any help would be most appreciated!

Rgds,

Eijaz




--

Dave Peterson


--

Dave Peterson



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Export selected Sheet in a new workbook with old workbook name!

Why not just delete the other sheets
select all the cells
edit|copy
edit|paste special|values
and save it as the original name.



gr8guy wrote:

Hi,

Once Again, I'll Explain:

From,
OldWorkbook (named Eijaz) - 3 sheets
Create,
New Workbook (named Eijaz&Now()) - 2nd sheet of OldWorkbook(named as say
"Sept", found in Cell "A1" on sheet)
Once Created,
Delete OldWorkbook (optional)

Rgds,

Eijaz

"gr8guy" wrote in message
...
Hi,

I have a workbook with 3 sheets in it. middle sheet has table of values,
which i want to export as a new workbook having only 1 sheet(that sheet) &
this new workbook must be named as old workbook & sheet should have just

the
table formats & values, no Formulas.

Also, wanted to add, if there is a way to export new worksheet as new
workbook, with old name & delete the old workbook simultaneously, to save
space in hard-disk.

Any help would be most appreciated!

Rgds,

Eijaz




--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Export selected Sheet in a new workbook with old workbook name!

Yeah, I think it's possible.

But I would be hesitant to do this. By destroying the old workbook, don't you
lose the abililty to go back and just double check that things worked. (I'm
always afraid that something will go wrong and the data will be lost forever.)

But if you really want, this seemed to work ok for me:

Option Explicit
Sub testme()

Dim keepWks As Worksheet
Dim NameToUse As String

Set keepWks = ThisWorkbook.Worksheets("sheet2")
NameToUse = ThisWorkbook.FullName

keepWks.Copy 'to a new workbook
Set keepWks = ActiveSheet 'in the new workbook

With keepWks
.UsedRange.Value = .UsedRange.Value
.Name = .Range("a1").Value
End With

Application.DisplayAlerts = False
ThisWorkbook.SaveAs Filename:=Environ("temp") & "\deletemelater.xls"
Application.DisplayAlerts = True

Application.DisplayAlerts = False
keepWks.Parent.SaveAs Filename:=NameToUse
Application.DisplayAlerts = True

ThisWorkbook.Saved = True
ThisWorkbook.ChangeFileAccess xlReadOnly
Kill ThisWorkbook.FullName

ThisWorkbook.Close savechanges:=False

End Sub

I didn't do any validation. I expect that the value in A1 represents a valid
worksheet name.

If I were testing this, I'd comment out that Kill statement. If things didn't
work ok, then go to your windows temp folder and move deletemelater.xls to a
nice spot to save the data.



gr8guy wrote:

Hi Dave,

First Because, I have a lot of workbooks, & second because I will be
attaching this code to a button on sheet3, Old workbook, for every old
workbooks.

Please note that the Delete idea is optional. Just Wanted to know if it can
be done!

Rgds,

Eijaz

"Dave Peterson" wrote in message
...
Why not just delete the other sheets
select all the cells
edit|copy
edit|paste special|values
and save it as the original name.



gr8guy wrote:

Hi,

Once Again, I'll Explain:

From,
OldWorkbook (named Eijaz) - 3 sheets
Create,
New Workbook (named Eijaz&Now()) - 2nd sheet of OldWorkbook(named as say
"Sept", found in Cell "A1" on sheet)
Once Created,
Delete OldWorkbook (optional)

Rgds,

Eijaz

"gr8guy" wrote in message
...
Hi,

I have a workbook with 3 sheets in it. middle sheet has table of

values,
which i want to export as a new workbook having only 1 sheet(that

sheet) &
this new workbook must be named as old workbook & sheet should have

just
the
table formats & values, no Formulas.

Also, wanted to add, if there is a way to export new worksheet as new
workbook, with old name & delete the old workbook simultaneously, to

save
space in hard-disk.

Any help would be most appreciated!

Rgds,

Eijaz




--

Dave Peterson


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I export a row of data into its own workbook LMM_0809 Excel Worksheet Functions 1 August 27th 09 04:03 PM
Export to new workbook Supe Excel Discussion (Misc queries) 1 December 18th 07 05:36 PM
Select sheet tabs in workbook & save to separate workbook files stratocaster Excel Worksheet Functions 2 March 1st 06 03:35 PM
Copy sheet from one workbook to another workbook problem Ron de Bruin Excel Programming 3 August 5th 04 07:19 PM
Export just one sheet from a workbook Grek[_3_] Excel Programming 2 May 9th 04 01:52 PM


All times are GMT +1. The time now is 06:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"