#1   Report Post  
Posted to microsoft.public.excel.programming
ihr ihr is offline
external usenet poster
 
Posts: 1
Default Ian


I am trying to semi automate the creation on a new worksheet within a
book.

I have recorded a macro which copies a master worksheet.

I would like to offer users a button to initiate the macro and ideally
have the new sheet given a name based on the content of the cell
highlighted when the macro is run.

any ideas?

Ian


--
ihr
------------------------------------------------------------------------
ihr's Profile: http://www.excelforum.com/member.php...o&userid=18944
View this thread: http://www.excelforum.com/showthread...hreadid=508944

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Ian

right click sheet tabview code copy/paste this. chg column to your list
double click on the typed in name in the cell desired in column k

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Target.Column < 11 Then Exit Sub
Sheets.Add
ActiveSheet.Name = Target
End Sub

--
Don Guillett
SalesAid Software

"ihr" wrote in message
...

I am trying to semi automate the creation on a new worksheet within a
book.

I have recorded a macro which copies a master worksheet.

I would like to offer users a button to initiate the macro and ideally
have the new sheet given a name based on the content of the cell
highlighted when the macro is run.

any ideas?

Ian


--
ihr
------------------------------------------------------------------------
ihr's Profile:
http://www.excelforum.com/member.php...o&userid=18944
View this thread: http://www.excelforum.com/showthread...hreadid=508944



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Ian

for a master worksheet (assume named Master) it would be

Private Sub Worksheet_BeforeDoubleClick( _
ByVal Target As Range, Cancel As Boolean)
If Target.Column < 11 Then Exit Sub
With ThisWorkbook
.Worksheets("Master").Copy After:=.Worksheets( _
.Worksheet.count)
End With
ActiveSheet.Name = Target
End Sub

--
Regards,
Tom Ogilvy



"Don Guillett" wrote in message
...
right click sheet tabview code copy/paste this. chg column to your list
double click on the typed in name in the cell desired in column k

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Target.Column < 11 Then Exit Sub
Sheets.Add
ActiveSheet.Name = Target
End Sub

--
Don Guillett
SalesAid Software

"ihr" wrote in message
...

I am trying to semi automate the creation on a new worksheet within a
book.

I have recorded a macro which copies a master worksheet.

I would like to offer users a button to initiate the macro and ideally
have the new sheet given a name based on the content of the cell
highlighted when the macro is run.

any ideas?

Ian


--
ihr
------------------------------------------------------------------------
ihr's Profile:
http://www.excelforum.com/member.php...o&userid=18944
View this thread:

http://www.excelforum.com/showthread...hreadid=508944





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Ian


Thanks :)

Tom - the master copy works great - needed to add an s ...

worksheet*s*.count

final copy in use also exits if target is blank...

Private Sub Worksheet_BeforeDoubleClick( _
ByVal Target As Range, Cancel As Boolean)
If Target.Column < 22 Then Exit Sub
If Target = "" Then Exit Sub
With ThisWorkbook
.Worksheets("Master_BOM").Copy After:=.Worksheets(.Worksheets.Count)
End With
ActiveSheet.Name = Target
End Sub



Ia

--
ih
-----------------------------------------------------------------------
ihr's Profile: http://www.excelforum.com/member.php...fo&userid=1894
View this thread: http://www.excelforum.com/showthread.php?threadid=50894

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



All times are GMT +1. The time now is 07:36 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"