LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Macro works once, not twice

I created a macro that sits on a worksheet(A), when run, it unhides
worksheet(B) and makes a copy of worksheet(B) prompting the user to
name the new worksheet(C). This works well. Part two of the process
includes a button on worksheet(C) that references the same macro on
worksheet(A). Clicking the button on worksheet(C) gives me a
"run-time error 1004" asking if I would like to debug. Debugging tags
this line in the macro:

Sheets("Earnings Code").Select

Full macro looks like this:

Sub NewEarningsCodeSheet()
Call UnhideEarningsCode
Sheets("Earnings Code").Select
shName = Application.InputBox("Enter The Name of the New Earnings
Code", "Delphia Consulting")
If (shName = False) Or shName = "" Then Exit Sub

Sheets("Earnings Code").Copy After:=Sheets(4)
ActiveSheet.Name = shName


End Sub

What am I doing wrong? It seems like it can only copy the worksheet
once or that it is trying to find it in a different location. I
appreciate any help, as I am somewhat new to this. Fun though.
 
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
Macro works Macro does not work Wanna Learn Excel Discussion (Misc queries) 4 March 24th 08 12:51 PM
Email Macro only sometime works? PaulW Excel Discussion (Misc queries) 0 August 15th 06 10:22 AM
macro works separately but not together... Gbiwan Excel Programming 4 February 18th 04 03:44 AM
Macro works from RUN but not from shortcut Joe Pyrdek Excel Programming 1 November 29th 03 03:53 PM
macro works in .xlt but not .xls BrianG[_3_] Excel Programming 6 September 18th 03 10:13 PM


All times are GMT +1. The time now is 09:26 AM.

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"