Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Copy from active sheet and paste into new sheet using info from cell in active

Hi,
I'm having an excel sheet named 'Box'. In Cell "B7".
I have an info with 'Box1'.
In the area "A10:H100" I have a lot of values calculated by formulas.


What I want is a macro that create a new sheet using the name from "B7"

then copy A10:H100 from active sheet 'box' and then paste special with
only
the values in the new sheet 'box1".


After changing all the values in A10:H100 and "B7" to 'box2' ( in 'box'

)I will be able to have the macro do the same procedure again but this
time paste special to 'Box2' and so on.

Is this possible with a macro or maybe 2 macros?


Thanks
Ingve

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Copy from active sheet and paste into new sheet using info from cell in active

Sub CopyData()
Dim sh as Worksheet, Sh1 as Worksheet
set sh = Worksheets("Box")
on error Resume Next
set sh1 = Worksheets(sh.Range("B7'))
On Error goto 0
If sh1 is nothing then
worksheets.Add After:=worksheets(Worksheets.count)
set sh1 = worksheets(worksheets.count)
sh1.Name = sh.Range("B7")
end if
sh.Range("A10:H10").copy
sh1.Range("A1").PasteSpecial xlValues
End Sub

--
Regards,
Tom Ogilvy



"Ingve" wrote in message
oups.com...
Hi,
I'm having an excel sheet named 'Box'. In Cell "B7".
I have an info with 'Box1'.
In the area "A10:H100" I have a lot of values calculated by formulas.


What I want is a macro that create a new sheet using the name from "B7"

then copy A10:H100 from active sheet 'box' and then paste special with
only
the values in the new sheet 'box1".


After changing all the values in A10:H100 and "B7" to 'box2' ( in 'box'

)I will be able to have the macro do the same procedure again but this
time paste special to 'Box2' and so on.

Is this possible with a macro or maybe 2 macros?


Thanks
Ingve



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Copy from active sheet and paste into new sheet using info from cell in active

Thanks a lot Tom!,

I got an error on this line:
set sh1 = Worksheets(sh.Range("B7'))

But I quickly found out that replacing the ' after B7 with " did the
trick:-)

Regards
Ingve

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Copy from active sheet and paste into new sheet using info from cell in active

We can't all be great typists <g

--
Regards,
Tom Ogilvy

"Ingve" wrote in message
ps.com...
Thanks a lot Tom!,

I got an error on this line:
set sh1 = Worksheets(sh.Range("B7'))

But I quickly found out that replacing the ' after B7 with " did the
trick:-)

Regards
Ingve



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
Copy sheet and make new sheet active belvy123 Excel Discussion (Misc queries) 5 April 24th 08 03:33 PM
copy name from active sheet to cell - using macro or function dymek Excel Worksheet Functions 2 October 2nd 06 12:32 PM
Active Cell Copy And Paste Sheet to Sheet A.R.J Allan Jefferys New Users to Excel 4 May 4th 06 02:04 AM
Create new sheet from cell-info and then copy/paste special Ingve Excel Programming 0 January 19th 06 10:58 PM
To copy from a range in another sheet to the active cell raja Excel Programming 1 September 8th 05 04:47 PM


All times are GMT +1. The time now is 07:36 AM.

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"