View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Mikus Mikus is offline
external usenet poster
 
Posts: 33
Default Copying sheet and generating name of new sheet

Hi FSt1

Thanks for your time and here are my reply to your post:

1) I don't have any problems with formula i wrote. It works fine. As Mike
Fogelman (in later post) noticed i am using ; instead of , and it is becouse
i live in Latvia and ; is our default list seperator :)

2) Mike Fogelman (in later post) has also noticed macro will work fine and
there will be no error cuz i need sheet numbers from 1 to 31 (or 28) and they
will represent days of the month not days of the week. I will have new
workbook for each month.

3) Yes, you are right sure i need somethin else - that code was just an
example of what i am using now. My first experience with VBA in excel really
:)

4) Thanks for information, i named it ctrl + n

Ok. now the macro it self
Thanks for macro code ... that was almost what i need. I modified it little
bit so it now looks like this

Sub Add_sheet()

Sheets("Blank").Select 'Selects template
Range("A1:Q200").Copy 'Copies template
Sheets.Add 'Add new sheet
ActiveSheet.Paste 'Pastes template
ActiveSheet.Range("A1").FormulaR1C1 = Date 'Adds todays day
ActiveSheet.Name = ActiveSheet.Range("M8") 'Names sheet

End Sub

This is what i wanted, but can i only copy particular range from sheet
"blank "? My original idea was to copy whole sheet (with all options and all
formatings... i wanted macro that would reproduce copy sheet operation [right
click on tab - move or copy - crate a c copy] ).

I now have these problems (none of these problems occur if i manualu copy
sheet "blank"):
1) New sheet doesn't have blank sheet options - for example don't show
gridlines option
2) New sheet doeen't have column widths like they were set on blank sheet
3) I need to re-define (create new) some name definitions while copying,
becouse new sheet contains #Ref errors. For example blank sheet has name
definition: =blank!$H$3:$H$65536.... after copying new name should be
created: "new generated name"!$H$3:$H$65536. For example =15!$H$3:$H$65536.
This would avoid #Ref errors.
4) In "blank" sheet 2nd row is hidden in new sheet this row is un-hidden...
I would like it to stay hidden