Macro Not Working

Hi can any please advise me why my Macro is not working

The Macro allows users to Input dates via a message box which shoul
then be  input in cells B1, B2, B3 & B4 - but this does not happen - I
addition when I try to change the sheet name in the macro from Sheet2 t
another name i.e. mydata  it displays an error 



Sub Input_Dates1()
'
'
MyName = InputBox("Please Enter Date for Q1")
If MyName = "" Then
Exit Sub
End If
Sheet2.Range("$B$1").Value = MyName

MyName = InputBox("Please Enter Date for Q2")
If MyName = "" Then
Exit Sub
End If
Sheet2.Range("$B$2").Value = MyName

MyName = InputBox("Please Enter Date for Q3")
If MyName = "" Then
Exit Sub
End If
Sheet2.Range("$B$3").Value = MyName

MyName = InputBox("Please Enter Date for Q3")
If MyName = "" Then
Exit Sub
End If
Sheet2.Range("$B$4").Value = MyName


End Sub



Any help would be appreciated


Excel version 2000



Many thanks



Ro

--
robertgu

44 Married two kid
-----------------------------------------------------------------------
robertguy's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=596
View this thread: http://www.excelforum.com/showthread.php?threadid=26381

0
9/27/2004 1:03:44 PM
excel.misc 78881 articles. 5 followers. Follow

7 Replies
523 Views

Similar Articles

[PageSpeed] 58

Are you sure you have a sheet 2 in your workbook

--
LB7
-----------------------------------------------------------------------
LB79's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1215
View this thread: http://www.excelforum.com/showthread.php?threadid=26381

0
9/27/2004 2:05:41 PM
hi,
try this
Dim myname As Date

myname = InputBox("Please Enter Date for Q1")
If IsNull(myname) Then
Exit Sub
End If
Sheet2.Range("$B$1").Value = myname

but if they don't input a date there will be a type 
mismatch error.

>-----Original Message-----
>
>Hi can any please advise me why my Macro is not working
>
>The Macro allows users to Input dates via a message box 
which should
>then be  input in cells B1, B2, B3 & B4 - but this does 
not happen - In
>addition when I try to change the sheet name in the macro 
from Sheet2 to
>another name i.e. mydata  it displays an error 
>
>
>
>Sub Input_Dates1()
>'
>'
>MyName = InputBox("Please Enter Date for Q1")
>If MyName = "" Then
>Exit Sub
>End If
>Sheet2.Range("$B$1").Value = MyName
>
>MyName = InputBox("Please Enter Date for Q2")
>If MyName = "" Then
>Exit Sub
>End If
>Sheet2.Range("$B$2").Value = MyName
>
>MyName = InputBox("Please Enter Date for Q3")
>If MyName = "" Then
>Exit Sub
>End If
>Sheet2.Range("$B$3").Value = MyName
>
>MyName = InputBox("Please Enter Date for Q3")
>If MyName = "" Then
>Exit Sub
>End If
>Sheet2.Range("$B$4").Value = MyName
>
>
>End Sub
>
>
>
>Any help would be appreciated
>
>
>Excel version 2000
>
>
>
>Many thanks
>
>
>
>Rob
>
>
>-- 
>robertguy
>
>44 Married two kids
>----------------------------------------------------------
--------------
>robertguy's Profile: http://www.excelforum.com/member.php?
action=getinfo&userid=5963
>View this thread: 
http://www.excelforum.com/showthread.php?threadid=263813
>
>.
>
0
anonymous (74722)
9/27/2004 2:15:17 PM
when you say it is not working, what is the error you are getting?

the only thing that i can see is that you have not defined a variabl
'myname'

--
icestationzbr
-----------------------------------------------------------------------
icestationzbra's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=458
View this thread: http://www.excelforum.com/showthread.php?threadid=26381

0
9/27/2004 2:16:53 PM
It works OK for me, do you have in a standard module? Theres nothing wrong
with the code but
Sheet2 is Sheet2 regardless of what you may rename it,
If you use Sheets("MyData") it will respond to the name you have given the
sheet,
Regards,
"robertguy" <robertguy.1d8tmn@excelforum-nospam.com> wrote in message
news:robertguy.1d8tmn@excelforum-nospam.com...
>
> Hi can any please advise me why my Macro is not working
>
> The Macro allows users to Input dates via a message box which should
> then be  input in cells B1, B2, B3 & B4 - but this does not happen - In
> addition when I try to change the sheet name in the macro from Sheet2 to
> another name i.e. mydata  it displays an error
>
>
>
> Sub Input_Dates1()
> '
> '
> MyName = InputBox("Please Enter Date for Q1")
> If MyName = "" Then
> Exit Sub
> End If
> Sheet2.Range("$B$1").Value = MyName
>
> MyName = InputBox("Please Enter Date for Q2")
> If MyName = "" Then
> Exit Sub
> End If
> Sheet2.Range("$B$2").Value = MyName
>
> MyName = InputBox("Please Enter Date for Q3")
> If MyName = "" Then
> Exit Sub
> End If
> Sheet2.Range("$B$3").Value = MyName
>
> MyName = InputBox("Please Enter Date for Q3")
> If MyName = "" Then
> Exit Sub
> End If
> Sheet2.Range("$B$4").Value = MyName
>
>
> End Sub
>
>
>
> Any help would be appreciated
>
>
> Excel version 2000
>
>
>
> Many thanks
>
>
>
> Rob
>
>
> --
> robertguy
>
> 44 Married two kids
> ------------------------------------------------------------------------
> robertguy's Profile:
http://www.excelforum.com/member.php?action=getinfo&userid=5963
> View this thread: http://www.excelforum.com/showthread.php?threadid=263813
>


0
alan111 (581)
9/27/2004 2:17:31 PM
When i ran this code it worked ok - all i did was change the sheet nam

--
LB7
-----------------------------------------------------------------------
LB79's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1215
View this thread: http://www.excelforum.com/showthread.php?threadid=26381

0
9/27/2004 2:21:18 PM
If you use the code you pasted you should either change the sheet name
in the code to match the sheet name in your workbook, or change your
sheet name in your workbook to "Sheet2" - the sheet names must match or
it will not work.


-- 
LB79
------------------------------------------------------------------------
LB79's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=12156
View this thread: http://www.excelforum.com/showthread.php?threadid=263813

0
9/27/2004 4:29:01 PM
Sorry but that's not quite right, if you use Sheet2.Range("A1") as opposed
to Sheets("Sheet2").Range("A1") then Sheet2 remains as Sheet2 regardless of
what you rename it. In the VB Editor one can see Sheet2 (Sheet2) which is
how VB sees Sheet2, the Sheet2 in brackets is what you choose to rename it,
Regards
"LB79" <LB79.1d92w0@excelforum-nospam.com> wrote in message
news:LB79.1d92w0@excelforum-nospam.com...
>
> If you use the code you pasted you should either change the sheet name
> in the code to match the sheet name in your workbook, or change your
> sheet name in your workbook to "Sheet2" - the sheet names must match or
> it will not work.
>
>
> --
> LB79
> ------------------------------------------------------------------------
> LB79's Profile:
http://www.excelforum.com/member.php?action=getinfo&userid=12156
> View this thread: http://www.excelforum.com/showthread.php?threadid=263813
>


0
alan111 (581)
9/27/2004 5:53:25 PM
Reply:

Similar Artilces:

I have published a worksheet to the web and it works good but one problem please help
Hello I published a worksheet to the web. The address is http://www.inforamp.com/~kidd/html/pmcshop1.htm The problem is I want to get rid of the scroll bars and the top men bar so ONLY the worksheet is present. Can someone tell me what I did wrong You help is greatly appricated Pau -- kid ----------------------------------------------------------------------- kidd's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1579 View this thread: http://www.excelforum.com/showthread.php?threadid=27378 ...

Need Help (i'm at the end of my rope) WMP wont work Missing DRM
Hello, i konw i'm new here but i'm really at the end of my rope. i had to upgrade my motherboard and processer not long ago, and when i did i seemed to lost my drm folder in windows. i have tried everything i can find online, including upgrading windows vista to windows 7 (no good) show all hidden files to delete all files in drm folder. (no drm folder) went to that upgrade drm thing microsoft has and i cant because the button is greyd out or i get a error in internet explorer. running a reg cleaner for missing dll's. i'm losing it. i need major help. please ...

Junk mail filter stopped working
What might have been a reason for my junk mail filter no longer working, all of a sudden - - I even changed the setting for Junk Mail from Low to High.....still, it's not filtering anything at all. Sorry - I forgot to mention - it's Outlook 2003 "Elmo Watson" <sputnik@nospam.yahoo.com> wrote in message news:u9CfXT3tGHA.2224@TK2MSFTNGP06.phx.gbl... > What might have been a reason for my junk mail filter no longer working, > all of a sudden - - > > I even changed the setting for Junk Mail from Low to High.....still, it's > not filtering anyth...

Cell Macro
I'm creating a stationery order form as a spreadsheet which uses the "IF" function to decide which items go on the final form. I need a way to hide the cells which aren't being used or move all the used cells to the top of the form, because at the moment Excel is printing out 4 pages of boxes when only one item is being ordered. Can anyone help? Thanks, Eilidh Eilidh This should do it: Sub HideRows() Dim rng As Range Set rng = Range("B1:B400") 'alter this range to suit the Qty range rng.Select 'Make sure all row are visible Selection.EntireRow.H...

finding duplicate then copying macro..
Ok, first of all, this community has been so great, and I wanted to thank you all. I have a new thing i need to do, and i was wanting to see if anyone can help me. I need a macro that will look at the information on the current sheet, and compare it to the information on the previous sheet and copy a value. here is what i need If any value on the current sheet in column A B and C matches anything on the previous sheet in column A B and C (The line needs to have all 3 match), then the macro would copy the value in the G column to the new page. For example Sheet 13 A B C G Cat D...

ALWAYS get Disable Macros warning
We have a user here that when opening Excel, he always gets the Macro warning... even if he sets the Macro security to "low". Is there a fix for this? Thanks ...

Work Flow question
Can we make a rule that evaluates the status of a bit type atribute? I wish to check to see is a Yes or No (Bit Type Atribute)has been selected in a particular atribute. Any help would be appreciated Yes, you can create a rule that evaluates a bit-type field and then create an action. "jfarruggia" wrote: > Can we make a rule that evaluates the status of a bit type atribute? I wish > to check to see is a Yes or No (Bit Type Atribute)has been selected in a > particular atribute. Any help would be appreciated Chad is right. I would suggest that you create a manual r...

Excel 2002 : How to rename a macro ?
Hello everybody, It may be a silly question, but... Using Excel 2002, How can I rename the different macros I created? Thanks in adavance for your kind help. Best regards, Daniel Daniel, press Alt+F11 to open the VBA editor, click on the module on the left where your macros are stored and change the name there -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2000 & 2003 "Daniel" <notmyrealaddress@wanadoo.fr> wrote in message n...

Dynamic macro's #5
Sorry guys, but I don't think I get it... :( I just don't seem to handle the variants and declarations correctly. I need to recognize wich row is selected/highlighted, and to use thi variable in the rest of the program. Any ideas? Thanks -- Ekse ----------------------------------------------------------------------- Ekser's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1140 View this thread: http://www.excelforum.com/showthread.php?threadid=27494 vb code will not recognize rows that you have selected with the mouse. find a way to enter crieteri...

Vs2008 macros: Sorting lines in a file [OT?]
OT for MFC? ... sorry I'm relatively new to using the macro capabilities built into Visual Studio. I'd like to be able to Select-All and sort the lines in a file, but I don't see how to do this. Suppose the file of comprised of: line 123 line 321 line 222 line 111 line 987 line 789 After the macro runs, the lines in the file should be: line 111 line 123 line 222 line 321 line 789 line 987 Note my question isn't how to do this with C++/MFC, but how to do this with VBA. Well, there is the old-fashioned bubble sort, if your data set isn't very large. Start at the ...

digitally signed macros #2
Our company has just migrated to Office 2007 and we are going nuts trying to get our existing macros to work properly. How do most companies handle macro security? Should we be digitally signing all of our macros and set our workstations to only accept macros that we have created and, if so, how do we achieve this? How about storing them in a Trusted folder? You need the Developer tab visible Click the Orange Office button Click the Excel Options button Select Popular from the left-hand menu pane In the right-hand pane, click the 'Sow developer tab in the Ribbon' checkbox re...

Help! Send To\Mail Recipient feature doesnt work. #2
I have WinXP w/Outlook 2003. When I right click a file and choose Send To\Mail Recipient, the feature does not work. I have got it to work one time by going to Control Panels\Add Remove Programs\Set Program Access and Defaults. There I select Microsoft Windows, (instead of Custom), restart the computer and I can then send to mail recipient, but only one time. After that I get the Error message, Microsoft Office Outlook, The operation failed. This feature works when I select Outlook Express as my default Email client in Internet options. Please can someone help! Thanks in advance. Gregg "...

Macro Recording #2
HELP, PLEASE!! My Stop Recording Toolbar does not appear on screen, when trying to record a new macro.... How can I re-display this? Any help appreciated! Sandi Sandi, when you are recording a macro go to view toolbars and check stop recording, it should be there after that -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Sandi Rush" <anonymous@discussions.microsoft.com> wrote in message news:7ae401c52671$1db358a0...

Auto-save of e-mail does not work with Word as mail editor!
I am using Office Microsoft Professional 2003, with Windows XP Pro with SP2. I use Outlook as my main e-mail program, and have "use Word as e-mail editor" selected. I have "auto-save" chosen in preferences, so while writing a longer e-mail, at specified time intervals the message will auto save, so that if my computer crashes while writing, I will not have lost what I write. However, while writing an e-mail that takes longer than the specified time interval for auto-save, a box keeps popping up that says (with "Microsoft Word" in the heading): "Savin...

PDF Macro
I have a macro that prints to PDF, but each time, it prompts the user to choose a directory/file name to save it as. Is there code to write to bypass this and to use the current name and the default directory? Thanks! Brett Hi Brett, Show us the code and we might be able to modify it. -- Thanks, Shane Devenshire "brett.kaplan@gmail.com" wrote: > I have a macro that prints to PDF, but each time, it prompts the user > to choose a directory/file name to save it as. Is there code to write > to bypass this and to use the current name and the default directory? > >...

CRichEditCtrl::SetOptions(ECOOP_OR, ECO_AUTOWORDSELECTION) does not work.
the rich edit control does not do word-around selection when the user double-clicks the a word in rich edit window. So i wanna use SetOptions() to figure it out, but unlucky it still does work after that. following code is snippet. class CMyView {... m_wndRichEdit; }; CMyView::OnCreate(...) {... m_wndRichEdit.Create(WS_CHILD | WS_VSCROLL | WS_VISIBLE | ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | ES_SUNKEN | ES_NOHIDESEL , CRect(0,0,0,0), this, ID_WND_RICHEDIT); m_wndRichEdit.SetFont(...); m_wndRichEdit.SetOptions(ECOOP_OR, ECO_AUTOWORDSELECTION); } -...

Account updates don't work
I have Money Plus Premium 08 (version 17.0.125.1415). I don't know if this version has SP1 or not. It did do an "update" a few weeks ago but the "About" dialog under help doesn't mention SP1. Anyhow, I have set Money to update my accounts from ML and a few other places, but the updates don't update any more. The last account transactions in Money are stuck at 03/16/08 (which may be around the time of the "update" that Money did). When I log on to ML I can see transactions since then but Money won't retrieve them. So, the question is, ho...

Close active Workbook with upper right hand X does not work
HI: I have Excel 2000 and have a BIG problem. the Upper right hand X for closing the Workbook does not work. It's grayed out. And when I pick File, Exit from the menu it wants to SAVE the spreadsheet/workbook even when it's new and blank. The only thing I've done is to add a template (Book1.xlt) that contains a macro for adding the full path to my footer. Your help would be appreciated. Bemused in Salem; Margie Are you using GroupWise? http://support.microsoft.com/default.aspx?scid=kb;en-us;260199 -- Regards, Peo Sjoblom (No private emails please, for everyone...

Compare function
Hi All, When I select the compare function it begins to compare and then half way through the following run-time error appears: "Run-time error "1101". The argument is not valid." And once I select ok the following error occurs: "An error occurred in the COM Add-in named: Compare Project Versions Error #:440. Please restart Microsoft Office Project to restart the COM Add-in." I have been on the web and I've tried the following fixes but still getting the same error. -Ensure duplicate columns don't exist in the table -Remove the COM Add-in ...

How do i delete a macro in Excel 2003 when delete isn't highlight
i can't delete macro in Excel 2003. i already set security at low and the delete portion of the pop=up window is not highlighted for selection and usage. Try this, Abel: http://www.officearticles.com/excel/remove_vba_code_from_a_workbook_in_microsoft_excel.htm ************ Anne Troy www.OfficeArticles.com "Abel" <Abel@discussions.microsoft.com> wrote in message news:32C1A70A-B7D0-409F-B3B4-C28008E1ADDE@microsoft.com... >i can't delete macro in Excel 2003. i already set security at low and the > delete portion of the pop=up window is not highlighted for se...

Excel Macro #5
We created a workbook that has several check boxes and a few Routing buttons. The problem we are running into is that when we get the routed workbook back from a few users all of the check boxes and and routing buttons have been removed. This only happens with about three users the other users work fine. Any suggestions I have already lowered the security to medium cwebb, Excel loves to move controls when a file's been saved and reopened. Maybe that's what happened to you. If that's the case, group them (right-click - group). That seems to keep them in place. -- Ear...

mailbox size defaults not working
I've just loaded SBS 2003 and imported the mailboxes from the old exchange server. In the system manager, Message delivery, defaults, I've set the Sending message size, Receiving message size and recipient limits to No limit. I've not overridden the settings in AD Users. However, I'm getting mailbox full and undeliverable returns when trying to send to a few users with large mailboxes. I've restarted the services (and the server), but nothing is making a difference. Am I missing something? I've loaded all the OS hotfixes and Exchange SP1. thanx. david Hi D...

Links don't work when converted to PDF...
I am doing a Newsletter for a friends business that will be emailed to her customers. For the articles that are too long for the space on the first page, I put a "more details" link to another page within the same document that contains the entire article. I was able to get this to work in Publisher. However, when I try to convert it to a PDF the links in the PDF don't work. I need this to work as I have to send the file as a PDF to the person who does her website so it can be added there each month. I have checked the "add bookmarks and links" button in ado...

DoCmd.OpenReport suddenly failing, macro print prints same report ok
This database has worked fine for a few years. Now on one machine only, DoCmd.OpenReport gives an "action failed" message about the macro that called the VBA function. There's an error handler in the function that does not get hit. If I replace the DoCmd.OpenReport with a DoCmd.RunMacro that prints the same report, that works! It's a simple report, no parameters. Any ideas what might have caused this? This sounds like the kind of corruption that a decompile could fix. Here's a standard sequence for sorting out this kind of thing. Follow it in order: 1. Uncheck t...

Desktop Alert Suddenly Doesn't Work
I have used Outlook 2007 without problems for several years. Just this week, my desktop alert stopped working on all incoming mail. I have double checked my settings, and they are correct. I have also double checked my rules, and have marked all incoming mail to display a desktop alert. Also, when I go into "Advanced Email Options" and "Desktop Alert Settings" (where you can alter the way the alert looks) and press "preview", nothing happens. This makes me think it is something bigger than just an unchecked settings issue. Any help? If you ...