Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Macro keeps locking up Excel 97

I wrote this macro to add a new page of data as necessary and then it hides
the original. Initially I needed 50 pages, so I quick wrote a macro to run
the following macro 50x.

Sub MakeSheet()
'


'
X = Worksheets.Count
Y = X - 3
Sheets("Blank").Visible = True
Sheets("Blank").Copy After:=Sheets(X)
Sheets("Blank (2)").Select
Sheets("Blank (2)").Name = Y
Sheets("Blank").Visible = False
Worksheets(X + 1).Activate
ActiveSheet.Unprotect
Range("A1") = Y
ActiveSheet.Protect

End Sub

It locks up excel after 20 or so times. So I manually ran the macro by
clicking a button each time. Again after 20 or 30 times Excel locks up. Does
anyone know why?

Thanks, Jim



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Macro keeps locking up Excel 97

go into the VBE and look in the project explore. Do you have code names
like

Sheet111111111111111111111111111

the maximum length is 31 or 32 I believe. This is a bug in Excel 97 when
you copy sheets.

Change the code name of the sheet you are copying to something like "A"

--
Regards,
Tom Ogilvy


"Jim" wrote in message ...
I wrote this macro to add a new page of data as necessary and then it

hides
the original. Initially I needed 50 pages, so I quick wrote a macro to

run
the following macro 50x.

Sub MakeSheet()
'


'
X = Worksheets.Count
Y = X - 3
Sheets("Blank").Visible = True
Sheets("Blank").Copy After:=Sheets(X)
Sheets("Blank (2)").Select
Sheets("Blank (2)").Name = Y
Sheets("Blank").Visible = False
Worksheets(X + 1).Activate
ActiveSheet.Unprotect
Range("A1") = Y
ActiveSheet.Protect

End Sub

It locks up excel after 20 or so times. So I manually ran the macro by
clicking a button each time. Again after 20 or 30 times Excel locks up.

Does
anyone know why?

Thanks, Jim





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Macro keeps locking up Excel 97

Do you mean change the sheet name? It is named Blank now. Or are you talking
about the code name in the project explore. It says Sheet2111(Blank) +
others like Sheet211110(10).
How do I do that? Thanks for your help!!


"Tom Ogilvy" wrote in message
...
go into the VBE and look in the project explore. Do you have code names
like

Sheet111111111111111111111111111

the maximum length is 31 or 32 I believe. This is a bug in Excel 97 when
you copy sheets.

Change the code name of the sheet you are copying to something like "A"

--
Regards,
Tom Ogilvy


"Jim" wrote in message ...
I wrote this macro to add a new page of data as necessary and then it

hides
the original. Initially I needed 50 pages, so I quick wrote a macro to

run
the following macro 50x.

Sub MakeSheet()
'


'
X = Worksheets.Count
Y = X - 3
Sheets("Blank").Visible = True
Sheets("Blank").Copy After:=Sheets(X)
Sheets("Blank (2)").Select
Sheets("Blank (2)").Name = Y
Sheets("Blank").Visible = False
Worksheets(X + 1).Activate
ActiveSheet.Unprotect
Range("A1") = Y
ActiveSheet.Protect

End Sub

It locks up excel after 20 or so times. So I manually ran the macro by
clicking a button each time. Again after 20 or 30 times Excel locks up.

Does
anyone know why?

Thanks, Jim







  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Macro keeps locking up Excel 97

Sheet211110(10)
codename Sheet211110
tab name 10

go into the vbe and click on

Sheet211110(10)
hit F4 to see the properties window.

Change the (name) property, the first property.

However, this would only be necessary if you are getting codenames that are
approach 30 characters. The one you show shouldn't be a problem, so
perhaps it is a different problem.

--
Regards,
Tom Ogilvy

"Jim" wrote in message ...
Do you mean change the sheet name? It is named Blank now. Or are you

talking
about the code name in the project explore. It says Sheet2111(Blank) +
others like Sheet211110(10).
How do I do that? Thanks for your help!!


"Tom Ogilvy" wrote in message
...
go into the VBE and look in the project explore. Do you have code names
like

Sheet111111111111111111111111111

the maximum length is 31 or 32 I believe. This is a bug in Excel 97

when
you copy sheets.

Change the code name of the sheet you are copying to something like "A"

--
Regards,
Tom Ogilvy


"Jim" wrote in message

...
I wrote this macro to add a new page of data as necessary and then it

hides
the original. Initially I needed 50 pages, so I quick wrote a macro

to
run
the following macro 50x.

Sub MakeSheet()
'


'
X = Worksheets.Count
Y = X - 3
Sheets("Blank").Visible = True
Sheets("Blank").Copy After:=Sheets(X)
Sheets("Blank (2)").Select
Sheets("Blank (2)").Name = Y
Sheets("Blank").Visible = False
Worksheets(X + 1).Activate
ActiveSheet.Unprotect
Range("A1") = Y
ActiveSheet.Protect

End Sub

It locks up excel after 20 or so times. So I manually ran the macro by
clicking a button each time. Again after 20 or 30 times Excel locks

up.
Does
anyone know why?

Thanks, Jim









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
Locking the macro view function Mattlynn via OfficeKB.com Excel Discussion (Misc queries) 5 September 18th 09 02:52 PM
row locking, instead of file locking? Bob W Excel Discussion (Misc queries) 2 September 7th 07 09:36 PM
Locking debug mode in a macro Megadrone Excel Worksheet Functions 1 November 30th 06 10:32 PM
locking formula in cells in without locking whole sheet SuziQ Excel Discussion (Misc queries) 1 July 21st 06 03:58 PM
Locking cells in Excel mauddib Excel Programming 2 December 23rd 03 01:19 PM


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