View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_7_] Bob Phillips[_7_] is offline
external usenet poster
 
Posts: 1,120
Default Macro assistance

sNew = Range("B3").Value
Sheets.Add.Name = sNew
Sheets("FlatCustomers").Cells(2, 2).Copy Worksheets(sNew).Range("B3")
Sheets("FlatCustomers").Cells(3, 2).Copy Worksheets(sNew).Range("B4")
etc.

--
HTH

Bob Phillips

"dthompson" wrote
in message ...

I am writing a macro that takes data from one table
adds it to another table, titles the new sheet and then loops down to
the next set of data and starts all over again.

My question is this:
How do I name the new sheet in the vba so it can recognize it through
out the code. This is what I am doing but I don't know how to call the
new sheet with the new name. Thanks for any suggestions on this method
or if there is a better way to go about this process.

Sheets("FlatCustomers").Select
Cells(2, 2).Select
Selection.Copy
Sheets.Add
Range("B3").Select
ActiveSheet.Paste
Range("B3").Select
ActiveSheet.Name = Range("B3").Value
Sheets("FlatCustomers").Select
Cells(3, 2).Select
Selection.Copy


--
dthompson
------------------------------------------------------------------------
dthompson's Profile:

http://www.excelforum.com/member.php...o&userid=25002
View this thread: http://www.excelforum.com/showthread...hreadid=385268