View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Simon Lloyd[_1226_] Simon Lloyd[_1226_] is offline
external usenet poster
 
Posts: 1
Default Macro to insert value from range on different sheet and copy sheet


This should do what you need:

Code:
--------------------
Sub create_sheets()
Dim Rng As Range, MyCell As Range
Application.ScreenUpdating = False
Set Rng = Sheets("Data").Range("LocCode")
For Each MyCell In Rng
Sheets("Summary").Range("C2").Value = MyCell.Value
With Sheets("Summary")
.Copy Befo=Sheets(2)
ActiveSheet.Name = .Range("C2").Value
End With
Sheets("Summary").Select
Next
Application.ScreenUpdating = True
End Sub
--------------------


Diddy;454184 Wrote:
Hi everyone,

I'm using C2 in "Summary" sheet as the lookup value for Index Match
formulas
pulling data from "Data" sheet. the lookup array where the C2 is found
is
A5:A67 (named range "LocCode" Location Code) on "Data".
"Summary" has a table of data and chart for each Location Code.
What I'd like to do now is have a macro that enters each Location Code
from
A5:A67 one at a time and copy the sheet and rename tab with the
relevant
Location Code so that I have 1 sheet per each location code.

If anyone can help me with this, it would make me happier than you can
imagine. I'm getting so muddled trying to do this one. Probably because
I'm
really cheesed off with this job. It was done as a favour. We're really
snowed under and thought that the person who asked for it would be
chuffed
with a dynamic workbook. Everyone seems to be in favour of electronic
version
and being green when it's not their project! Our boss, who originally
said we
were too busy just now,has now asked us to provide same data 1 sheet
per
Location Code because the other department "isn't very computer savvy"
and
they'd like to print it!!!! OMG!
Sorry!! Rant over.
Cheers
Diddy



--
Simon Lloyd

Regards,
Simon Lloyd
'Microsoft Office Help' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=125724