macro #2

I'm new at this so this might seem elementary but if you don't know you ask
those that do.
I've created a macro that is suppose to clear the input data on a worksheet
when a command button is clicked. However when the msgbox appears asking
them if they wish to continue and they click "yes" nothing happens.I've
included the code that I've written. Any help would be appreciated.

Private Sub cmdclear_Click()
MsgBox "Caution: You are about to delete the information on this worksheet"
& vbNewLine & vbNewLine & "Do you wish to continue?", 4, "Clear"
If response = vbYes Then
    copyoffatburner.xls = Application.Run("Clear")
Else: End
End If
End Sub



0
bjohnson (28)
8/29/2003 1:50:10 AM
excel.misc 78881 articles. 5 followers. Follow

3 Replies
609 Views

Similar Articles

[PageSpeed] 49

Carl,

There's nothing wrong with the basic "logic" of your coding.
If the user selects "Yes", the line of code:
>copyoffatburner.xls = Application.Run("Clear")
will execute.

Now...if "copyoffatburner.xls" is the file that you're already in,
you don't need to specify it.
If so, also, you don't need to specify "Application.Run"

Private Sub cmdclear_Click()
MsgBox "Caution: You are about to delete the information on this worksheet"
& vbNewLine & vbNewLine & "Do you wish to continue?", 4, "Clear"
If response = vbYes Then
     Clear
Else: Exit Sub
End If

Okay, so what's the code in the "Clear" sub???

John



"Carl Johnson" <bjohnson@woh.rr.com> wrote in message
news:mjy3b.20816$l41.4564786@twister.neo.rr.com...
> I'm new at this so this might seem elementary but if you don't know you
ask
> those that do.
> I've created a macro that is suppose to clear the input data on a
worksheet
> when a command button is clicked. However when the msgbox appears asking
> them if they wish to continue and they click "yes" nothing happens.I've
> included the code that I've written. Any help would be appreciated.
>
> Private Sub cmdclear_Click()
> MsgBox "Caution: You are about to delete the information on this
worksheet"
> & vbNewLine & vbNewLine & "Do you wish to continue?", 4, "Clear"
> If response = vbYes Then
>     copyoffatburner.xls = Application.Run("Clear")
> Else: End
> End If
> End Sub
>
>
>


0
jwilson (359)
8/29/2003 2:27:15 AM
One more take:

Private Sub cmdclear_Click()
dim response as long
response = MsgBox("Caution: You are about to delete the information" & _
              " on this worksheet" & vbNewLine & vbNewLine & _
              "Do you wish to continue?", 4, "Clear")

If response = vbYes Then
    worksheets("sheet1").range("Myrangename").clear '.clearcontents  
end if

End Sub

This assumes that you named your range "myrangename" via Insert|Name from Excel.

Your original message box just showed the message and response was never
changed.

(and I like .clearcontents to just empty the cells.  Clear will remove
formatting, too.)

Carl Johnson wrote:
> 
> I'm new at this so this might seem elementary but if you don't know you ask
> those that do.
> I've created a macro that is suppose to clear the input data on a worksheet
> when a command button is clicked. However when the msgbox appears asking
> them if they wish to continue and they click "yes" nothing happens.I've
> included the code that I've written. Any help would be appreciated.
> 
> Private Sub cmdclear_Click()
> MsgBox "Caution: You are about to delete the information on this worksheet"
> & vbNewLine & vbNewLine & "Do you wish to continue?", 4, "Clear"
> If response = vbYes Then
>     copyoffatburner.xls = Application.Run("Clear")
> Else: End
> End If
> End Sub

-- 

Dave Peterson
ec35720@msn.com
0
ec35720 (10082)
8/29/2003 3:02:56 AM
To both you and John for responding to my inquiry. I first tried John's but
it still did not run the macro. I then tried yours Dave and while it worked
unfortunately as you said it also deleted the formatting and comments as
well I,ve again included the code as I wrote it, maybe I am overlooking
something. Again your help would be appreciated.
Private Sub cmdclear_Click()
Dim response As Long
response = MsgBox("Caution: You are about to delete the information on this
worksheet." & _
       vbNewLine & vbNewLine & "Do you wish to continue?", 4)

If response = vbYes Then
    Worksheets("January").Range("Clear").Clear '.clearcontents
End If

End Sub

"Dave Peterson" <ec35720@msn.com> wrote in message
news:3F4EC260.E8D3037D@msn.com...
> One more take:
>
> Private Sub cmdclear_Click()
> dim response as long
> response = MsgBox("Caution: You are about to delete the information" & _
>               " on this worksheet" & vbNewLine & vbNewLine & _
>               "Do you wish to continue?", 4, "Clear")
>
> If response = vbYes Then
>     worksheets("sheet1").range("Myrangename").clear '.clearcontents
> end if
>
> End Sub
>
> This assumes that you named your range "myrangename" via Insert|Name from
Excel.
>
> Your original message box just showed the message and response was never
> changed.
>
> (and I like .clearcontents to just empty the cells.  Clear will remove
> formatting, too.)
>
> Carl Johnson wrote:
> >
> > I'm new at this so this might seem elementary but if you don't know you
ask
> > those that do.
> > I've created a macro that is suppose to clear the input data on a
worksheet
> > when a command button is clicked. However when the msgbox appears asking
> > them if they wish to continue and they click "yes" nothing happens.I've
> > included the code that I've written. Any help would be appreciated.
> >
> > Private Sub cmdclear_Click()
> > MsgBox "Caution: You are about to delete the information on this
worksheet"
> > & vbNewLine & vbNewLine & "Do you wish to continue?", 4, "Clear"
> > If response = vbYes Then
> >     copyoffatburner.xls = Application.Run("Clear")
> > Else: End
> > End If
> > End Sub
>
> --
>
> Dave Peterson
> ec35720@msn.com


0
bjohnson (28)
8/30/2003 12:06:07 AM
Reply:

Similar Artilces:

Formatting a subtotal line with a macro
I already have in use a macro that runs a sort and subtutal function. I would like to format the subtotal row using visual basic since there is already a macro in place. Hi Look at this: ActiveCell.Font.Bold = True Regards, Per "DJDKAL" <daniel.kalfayan@hotmail.com> skrev i meddelelsen news:A86040B0-B4C4-4E11-A80C-E80132C9710F@microsoft.com... >I already have in use a macro that runs a sort and subtutal function. I > would like to format the subtotal row using visual basic since there is > already a macro in place. This is what I've g...

Multiple domains on one Exchange server / All but one domain shows up as spam #2
I am sorry if this is on the board somewhere but I have been searching forever and havn't found a hint yet. I have multiple domains setup on my exchange server. Lets say abc.com, def.com, and hij.com. We only send email with @abc.com but can receive from any domain name. Recently we merged with another company and we brought back their email to our server, lets say xyz.com. Now I configured a new recipient on Exchange 2003, so I now have two policies. The first policy has the three original domains in it with @abc.com as the primary domain. In the second policy I have configured xyz.com t...

VB Macro #2
I have a macro that is generating Excel files. When the macro runs, it saves two different tabs in the workbooks as values. It needs to test and wait until the formulas that are pulling amounts from another database are correctly populated with the amounts. Right now, I am getting N/A# instead of amounts for some, but not all, of the files. I think the problem is that the formulas have not completed pulling the amounts before the macro pastes that tab as zeros. (N/A# is what appears when the formulas have not completed calculating - once they have completed, the N/A# is replaced ...

VCR to DVD Part 2
Many thanks for previous answers. Yes, finalizing the DVD worked I found that DVD-R need finalizing but DVD+RW disks do not But why was I able to play the unfinalized DVD-R on one machine and not on two others. What was special about the first PC? -- www.stfx.ca/people/bliengme Bernard Liengme wrote: > Yes, finalizing the DVD worked > I found that DVD-R need finalizing but DVD+RW disks do not > But why was I able to play the unfinalized DVD-R on one machine and not on > two others. > What was special about the first PC? Almost anything will play a finalised D...

Problem with macro assigned to custom toolbar button
Problem with macro assigned to custom toolbar button I am having a probelm with macros assigned to a custom button on custom button. I am using excel 2000. 1. I have created a macro called "Jump" in a workbook named "Test1" 2. I then created a custom toolbar and added a custom toolbar button t that toolbar. 3. Through the customize dialog box I assign the Macro "Jump" to th custom button. Everything works fine UNTIL. If I do a SAVE AS for the workbook "Test1" and call it something els like "Test2" and then close "Test2" an...

set print area #2
Where is the "set print area" button in Excel 2002 that was in Excel '97? =?Utf-8?B?Q2Fyb2wgTWM=?= wrote > Where is the "set print area" button in Excel 2002 that was in Excel '97? > Are you sure it was "standard"? Only way I could get in was to right-click the toolbar|Customise and drag it to the toolbar from Commands|File -- David ...

OEM publisher 2002 Sp1-2
I have the OEM version of Publisher 2002 and cannot find the Export as web page under File. Is there a way I can get that feature with a standalone disk? After managing to set up OE-QuoteFix on his new PC, Ed reads a message from Chicagogal <anonymous@discussions.microsoft.com>... > I have the OEM version of Publisher 2002 and cannot find the Export > as web page under File. Is there a way I can get that feature with a > standalone disk? The OEM version of Publisher is exactly the same as the release in every way but the license, so the standalone version will be no differen...

Macros not performing correctly
I recorded a macro to place a vlookup formula in four cells that are side by side. When I run the macro it only performs the first task, it does not go on to do the other three. I used the tab key to go to the next cell while recording the macro, I don't know if that's why it's not working or if it's something else. The script looks like this: Sub EERates() ' ' EERates Macro ' Macro recorded 3/4/2005 by BCBSOK ' ' ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-2],Sheet1!R3C1:R102C2,2,0)" Range("F15").Select ActiveCell.FormulaR1C...

GP SP#2 hangs with sa and Collections Issue
I just installed 8.0 SP#2 (ran the script that it says to run cuz we had upgraded from previous version to remove dups in smartlist tables) and when I log into GP as sa, it hangs and CPU sits at 100%. When I was able to log in previously to SP#2, I constantly received errors about the CN_Collector_MAIN table with invalid column names etc. I've deleted the table, then re-ran the create tables, but it keeps coming back with this error. I've even gone into file > maintenance > sql and deleted and recreated the table, but then get "number of results doesn't match ...

Changing ip address of exchange server #2
Hi, I have a back-end server and a smtp server in DMZ. I want to change ip address of back-end server. are there any issues? all incoming and outgoing emails are going via smart host. Hi, No issues at all as long as you remember to change all the references to this server in your firewall, SMTP scanner etc. Leif "Jack Dorson" <JackDorson@discussions.microsoft.com> wrote in message news:FE5927A1-D20D-4C6B-991F-2E1EFD19434D@microsoft.com... > Hi, > > I have a back-end server and a smtp server in DMZ. > > I want to change ip address of back-end server. are ...

How can I print on 8 1/2"x17" paper?
I have cut down an 11x17 paper to 8 1/2" x 17". I cannot figure out how to change the paper size to accept and print anything bigger than 14." any suggestions would be greatly appreciated First make the size settings in the Printer Setup. You may need to use the Custom selection. -- Don Vancouver, USA "mickilena" <mickilena@discussions.microsoft.com> wrote in message news:1AD99AFE-7FE7-4A07-9D20-1B1AFF9856BD@microsoft.com... >I have cut down an 11x17 paper to 8 1/2" x 17". I cannot figure out how to > change the paper size to accept a...

when opening an excel file, 2 files open (one is book1)?
When I click on an excel file, 2 excel documents open up. One document is called Book1 and the other document is the actual document that I want to open. How do I stop this from happening? Brian To prevent Book1 from opening you can append /e to your shortcut for opening Excel. "C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\EXCEL.EXE" /e Alternative to the above............ Go to Start>Settings>Folder>Options>File Types. Scroll down to MS Excel Worksheet. Then if running Win98 OS Edit> select "Open" and Edit. If using WinXP OS you would scroll down to...

Money Updates #2
Was wondering about money updates. What exactly is the program downloading during the update process? And if the program is updated on a daily basis, why would I ever need to upgrade to a newer version? In microsoft.public.money, invalid wrote: >Was wondering about money updates. What exactly is the program downloading >during the update process? And if the program is updated on a daily basis, >why would I ever need to upgrade to a newer version? It is mainly changes in online bank setup. Despite appearances is typically does not change anywhere daily. "invalid" <...

Can't create the item #2
I use Outlook from MS Office 2003 Business Edition. Everything has worked fine until the past few days. Now, whenever I click on an E-mail address link inside a webpage, I get a message from Outlook that says "Can't create the item." One person on this group gave me the following advice: >Close Outlook, find and rename the frmscache.dat to .old I did searches on all my drives and the file named above was not found. I doubled checked the search to confirm that it included hidden files and system folders in the search. Still no luck. More thoughts? ...

Does POS 2.0 support price-embedded barcodes?
Does anyone know if Microsoft Point of Sale 2.0 supports price-embedded barcodes (also known as random weight barcodes)? I have Digi scales that print out 12-digit barcodes with UPC and price info. I would like to implement POS and not RMS because it is much less complex. Thanks for any info. POS 2.0 does not support price-embedded barcodes. "Martin" wrote: > Does anyone know if Microsoft Point of Sale 2.0 supports price-embedded > barcodes (also known as random weight barcodes)? > > I have Digi scales that print out 12-digit barcodes with UPC and price info. &...

IMAP address on exchange sever #2
how can I find the IMAP address of my exchange server? ...

help #2
Hi, I need help with the following: I need to plot a 2-D column graph comparing the profit margin (y-axis) for the 3 items (x-axis) for Malaysia and Singapore, using the data below; Malaysia Item Mfr's Agent's Retailer's Selling GST Profit Total Cost Charge Markup Price Margin Lipstick 9.85 15.76 12.81 38.42 1.54 27.03 105.40 Toner 11.90 19.04 15.47 46.41 1.86 32.65 127.33 Cleanser 15.90 25.44 20.67 62.01 2.48 43.63 170.13 Total 37.65 60.24 48.95 146.84 5.87 103.31 402.86 Singapore Item Mfr's Agent's Retailer's Selling GST...

Report: Cell #1, Cell #2, Cell #3, Cell #4
I am stuck again and would love som help :( I would like to repeat all words found inside ~25 cells, separated only by ", ", ignoring empty cells. Data: A1: [Apple ] A2: [Orange] A3: [Banana] A4: [Tomato] A5: [Syrup ] A6: [ ] A7: [ ] A8: [ ] The result should be something like: [Apple, Orange, Banana, Tomato, Syrup] -- JemyM ------------------------------------------------------------------------ JemyM's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=26945 View this thread: http://www.excelforum.com/showthread.php?thre...

Application icon #2
Hello, all, Have a strange problem. I recently used the tool ResOrg to renumber the resource IDs in a project where there were hundreds of duplicates. This fixed a list of bugs, which is why I did it. The other programmers found three problems after this. One was trivial to fix, a second was actually a problem in the code that renumbering the resouce IDs uncovered and was also easily fixed. The third one is weird though. Renumbering the resources messed up the application icon. I verified this by recompiling with the old resource.h file and the icon is correct. In the renumbere...

Backing Up Outlook #2
I have Windows XP Professional installed. Is there a simple and straight forward way to back up all my Outlook folders and address books to CD? Look here for all the information you need on backup and restoration of Outlook data: http://www.slipstick.com/config/backup.htm -- Jocelyn Fiorello MVP - Outlook *** Replies sent to my e-mail address will probably not be answered -- please reply only to the newsgroup to preserve the message thread. *** "mel weston" <mel.weston@micronsecurity.com> wrote in message news:068d01c35018$e7f97b70$a601280a@phx.gbl... > I have...

direct deposit #2
I am in the process of setting up payroll. I am able to import(using integration mgr) Employee info, deductions, benefits, taxes, etc. I cannot seem to find anything about importing direct deposit information. Any assistance will be appreciated. Thanks As far as I know, there is no integration within integration manager that can handle this. The last time I ran into this, I had to use some sql scripts to get everything in to GP. "nfp" wrote: > I am in the process of setting up payroll. I am able to import(using > integration mgr) > Employee info, deductions, benef...

How to run ajax implemented .Net 3.5 to an old version 2.0
Hi, I have developed a Web Application in .Net 2008 and implemented <asp:UpdatePanel /> in it. But now I am trying to build it in .Net Version 2.0. But it gives an error -- "Error 1 Unknown server tag 'asp:UpdatePanel' ". I have downloaded earlier version of AjaxControlToolKit, but it does not work. What I have to do to build this code in version 2.0 Thanks and Regard Dg The UpdatePanel is not part of 2.0 or the Ajax Toolkit. This is an additional "Ajax extension for 2.0" download... Also as 3.5 is just 2.0 plus additional stuff, I wo...

retrieving the XmlEnumAttribute and the enum-values (2)
This post is a followup to the thread "retrieving the XmlEnumAttribute values for an Enum" in this same forum earlier this month, since my last query in that thread went unanswered. I have an enum defined (DotNet v2) as public enum velocityUom { [System.Xml.Serialization.XmlEnumAttribute("m/s")] ms = 21, [System.Xml.Serialization.XmlEnumAttribute("cm/a")] cma, ... } My original post was to ask how I could retrieve the XmlEnumAttribute values for this Enum so that I could create a combo box with values like "m/s", &qu...

Outlook vs Outlook express #2
What is the deference between outlook and outlook express. Outlook is a PIM, Outlook Express is a simply mail and news reader. http://support.microsoft.com/?kbid=257824 --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. After searching google.groups.com and finding no answer perry <pgautreaux2@cox.net> asked: | What is the deference between outlook and outlook express. ...

upgrade to ver 2
What is the step by step process to upgrade from RMS ver 1.3 TO 2. What sorts of issues should i expect. Hello. Merchants Consulting, LLC is a retail information technology specialist. They can help. Call 253-509-2110 and ask for Don. Thank you. "dexter" wrote: > What is the step by step process to upgrade from RMS ver 1.3 TO 2. What sorts > of issues should i expect. ...