Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default formatting a worksheet

Is there a way I can automatically create a new formatted sheet based on a
template when a user enters data in a master sheet.

for example, the user enters data into sheet A, if data is entered into a
particular column sheet B should be automatically created based on some
standard formatting in hidden sheet X. It is likely that there will be more
than 1 sheet B.

Any help in providing a solution would be appreciated.

--
neil
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default formatting a worksheet

Seems plausible enough...how about a Worksheet_Change event?
1. Create your template on a seperate sheet and set its Hidden property
to xlSheetVeryHidden
2. Create a WorkSheet_Change event behind Sheet A; something like
this...

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 2 Then
Application.ScreenUpdating = False
With Sheet3
.Visible = xlSheetVisible
.Copy after:=Sheets(1)
.Visible = xlSheetVeryHidden
End With
ActiveSheet.Name = "Template" & (ThisWorkbook.Sheets.Count - 1)
Me.Activate
Application.ScreenUpdating = True
End If
End Sub

Should work...

Hth,
OJ

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

You don't need to make a sheet visible to copy it.

--
Regards,
Tom Ogilvy


"OJ" wrote in message
oups.com...
Seems plausible enough...how about a Worksheet_Change event?
1. Create your template on a seperate sheet and set its Hidden property
to xlSheetVeryHidden
2. Create a WorkSheet_Change event behind Sheet A; something like
this...

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 2 Then
Application.ScreenUpdating = False
With Sheet3
.Visible = xlSheetVisible
.Copy after:=Sheets(1)
.Visible = xlSheetVeryHidden
End With
ActiveSheet.Name = "Template" & (ThisWorkbook.Sheets.Count - 1)
Me.Activate
Application.ScreenUpdating = True
End If
End Sub

Should work...

Hth,
OJ



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default formatting a worksheet

Tom

I am fairly new to vba, so I do not entirely understand the concepts that OJ
has tired to explain, but in any case could not get the code to work, can you
help.

thanks

"Tom Ogilvy" wrote:

You don't need to make a sheet visible to copy it.

--
Regards,
Tom Ogilvy


"OJ" wrote in message
oups.com...
Seems plausible enough...how about a Worksheet_Change event?
1. Create your template on a seperate sheet and set its Hidden property
to xlSheetVeryHidden
2. Create a WorkSheet_Change event behind Sheet A; something like
this...

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 2 Then
Application.ScreenUpdating = False
With Sheet3
.Visible = xlSheetVisible
.Copy after:=Sheets(1)
.Visible = xlSheetVeryHidden
End With
ActiveSheet.Name = "Template" & (ThisWorkbook.Sheets.Count - 1)
Me.Activate
Application.ScreenUpdating = True
End If
End Sub

Should work...

Hth,
OJ




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default formatting a worksheet

You sure about that Tom? If it is xlSheetVeryHidden then I think you do
have to make it visible before you copy it with this method. When I
remove the visible lines Excel throws up an error.....

Neil,
Create your TemplateSheet and hide it. Then...
RightClick over the sheet tab name for Sheet A and select 'View Code'.
Then paste in the code I wrote into the VB Window that comes up,
changing 'Sheet3' to 'Sheets("YourTemplateSheetNameInQuotesHere")'

Assuming Sheet A is the first sheet in your workbook, this will now
spit out a template sheet every time you manually change or add a value
in column B of Sheet A.

Personally, I would consider a command button to do this instead..

Hth,OJ



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default formatting a worksheet

I stand corrected. However, you can if it is hidden and Very Hidden really
doesn't buy you anything. Also, if you prefer very hidden, you can still
add a sheet and copy everything from the very hidden sheet without unhiding
it.

--
Regards,
Tom Ogilvy

"OJ" wrote in message
oups.com...
You sure about that Tom? If it is xlSheetVeryHidden then I think you do
have to make it visible before you copy it with this method. When I
remove the visible lines Excel throws up an error.....

Neil,
Create your TemplateSheet and hide it. Then...
RightClick over the sheet tab name for Sheet A and select 'View Code'.
Then paste in the code I wrote into the VB Window that comes up,
changing 'Sheet3' to 'Sheets("YourTemplateSheetNameInQuotesHere")'

Assuming Sheet A is the first sheet in your workbook, this will now
spit out a template sheet every time you manually change or add a value
in column B of Sheet A.

Personally, I would consider a command button to do this instead..

Hth,OJ



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
Worksheet Formatting phmckeever Excel Discussion (Misc queries) 0 August 25th 06 02:20 PM
Worksheet formatting JOUIOUI Excel Worksheet Functions 2 June 27th 06 07:31 PM
Worksheet Formatting K Excel Worksheet Functions 0 March 1st 06 07:40 PM
Formatting Worksheet Jdy Excel Programming 3 September 20th 04 05:10 PM
formatting a worksheet Steve Chatham[_2_] Excel Programming 1 November 4th 03 08:34 PM


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