Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
br549
 
Posts: n/a
Default fill a particular cell on a series of worksheets from a lookup tab

In the first worksheet of my workbook I have a list of part numbers listed in
a column, say approximately 20 part numbers. I would like to have one
worksheet for each part number, with cell A1 containing the part number for
that worksheet.

So if my list was:

pn1
pn37
pn469
pn2034

then cell A1 of the first worksheet in the series would ="pn1", cell a1 in
the second worksheet of the series would ="pn37"

Is there an easy way to populate these worksheets from the list?

Thanks,

Rob Samples
  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

You could use a little macro:

Option Explicit
Sub testme()
Dim testWks As Worksheet
Dim MstrWks As Worksheet
Dim myRng As Range
Dim myCell As Range

Set MstrWks = Worksheets("sheet1")
With MstrWks
Set myRng = .Range("a1", .Cells(.Rows.Count, "A").End(xlUp))
For Each myCell In myRng.Cells
Set testWks = Nothing
On Error Resume Next
Set testWks = Worksheets(myCell.Value)
On Error GoTo 0

If testWks Is Nothing Then
'add it
With Worksheets
Set testWks = .Add(after:=.Item(.Count))
On Error Resume Next
testWks.Name = myCell.Value
If Err.Number < 0 Then
MsgBox "Illegal name: " & myCell.Value & vbLf & _
"Please correct worksheet named: " _
& testWks.Name
Err.Clear
End If
On Error GoTo 0
testWks.Range("a1").Value = myCell.Value
End With
End If
Next myCell
End With
End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm


br549 wrote:

In the first worksheet of my workbook I have a list of part numbers listed in
a column, say approximately 20 part numbers. I would like to have one
worksheet for each part number, with cell A1 containing the part number for
that worksheet.

So if my list was:

pn1
pn37
pn469
pn2034

then cell A1 of the first worksheet in the series would ="pn1", cell a1 in
the second worksheet of the series would ="pn37"

Is there an easy way to populate these worksheets from the list?

Thanks,

Rob Samples


--

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
need check two worksheets to lookup a value Clay Excel Discussion (Misc queries) 2 January 5th 05 08:35 AM
fill series grayed out (not available, disactivated) Michel Dion (from IMS Health in Canada) Excel Discussion (Misc queries) 1 December 17th 04 02:35 AM
Excel Fill Series electromott Excel Discussion (Misc queries) 2 December 16th 04 02:55 PM
Identifying the Active Fill Color Steve Conary Excel Discussion (Misc queries) 3 December 9th 04 04:45 AM
Changing Cell Fill Colour Nick Excel Discussion (Misc queries) 4 December 6th 04 10:05 PM


All times are GMT +1. The time now is 07:27 PM.

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

About Us

"It's about Microsoft Excel"