Confirm Selection Before Running Macro

Oct 5, 2007

I have an excel form where users can input modifications by selecting a range and then pressing a command button to input a value in the selection.

My goal is: to restrict the location where a user can select a range of cell and then execute the macro . The cells where the user can use the macro are merged and in my code, I used the address as show in the address bar in excel for their location. If the user select a cell that is not permitted, a message box is displays and exits the code.


If (Selection.Address <> Range("AE7").Address) _
Or (Selection.Address <> Range("BM7").Address) Then
Msgbox ("Wrong location") Else

For some reason it doesn't work since the message box appears even if I am within the permitted locations.

Note: AE7 is the first cell of a merge, same as with BM7

View 9 Replies


ADVERTISEMENT

Dialog Box To Confirm Running Macro

Oct 18, 2005

i have a macro button designed to wipe all user entered data into a workbook. I want it so you cant accidently press (as you cannot undo the operation). Anyway for making a dialog box appear asking if you are sure to wipe date, with a yes or not option.. no will obviously abort the macro.

if possible, another box to come up asking if you want to save the file first with a different file name (comes up with a save as box).

this is the code so far:

Sub MonthCleaner()
'
' MonthCleaner Macro
' Macro recorded 17/10/2005
'

Application.ScreenUpdating = False

Range("A10:G10").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
Range("H10").Select .........

View 9 Replies View Related

Code To Stop A Worksheet Selection Change Macro Running

Aug 17, 2009

I've got a worksheet_selectionchange macro on a sheet, and another macro that you can run after it. The issue is that when the second macro runs, it also runs the selectionchange macro, and wipes some of the info that the second macro should be copying.

Is there a piece of code that I can use in the second macro to block the selectionchance code from running until it's compelte?

View 6 Replies View Related

Confirm Prompt Before Macro Runs

Nov 20, 2006

I have a button. When pressed, it runs a macro. Instead, after pressing the button, I would like the user to confirm to run the macro and display some info about it. This is to make sure the user does not accidentally run the wrong macro (button). I just need a prompt box, with a line info, and the two choices YES and NO. If NO is selected, nothing happens. If YES is selected, macro continues.

View 6 Replies View Related

Macro For Sending Emails :: Pop Up Confirm And Cancel

Oct 13, 2007

I'm using Excel 2002 on and XP machine. I am creating a spreadsheet to track a work plan.

Column A: Name
Column B: Date
Column C: Time
Column D: YES
Column E: No
Column F: New Date
Column G: New Time

What I'm looking to do is input click able buttons in Columns D: Yes and Column E: No.

When a user clicks on YES, a pop up window should appear with the data in columns A,B,C.

The p0p-up should contain CONFIRM and CANCEL buttons.

Asking the user if they want to confirm the date and Time.

If CONFIRM is clicked Excel should then send an email to me and the user to say that the work schedule has been confirmed.

If CANCEL is clicked the pop-up window closes.

Secondly if the user clicks NO, a pop-up window should open with two free text boxes. One for Proposed date and One for Proposed time. And again 2 buttons for Confirm and Cancel.

If Confirm is clicked then Excel should record the data entered in the free text boxes into Column G and Column H and send emails to me and the user with the Proposed date and Time Data.

If CANCEL is clicked the pop-up window closes.

View 9 Replies View Related

After Macro Saves File Msgbox To Confirm Save As Completed

Jan 18, 2014

I have a macro which works well. All it does is save a file to a specified location on my network. However, after a file is saved there is no prompt telling the user that the file was saved successfully leaving them wondering whether the macro actually worked.

VB:
Public Sub SaveAs() ThisFile = Range("X2").Value
ActiveWorkbook.SaveAs Filename:="legdcAudits" & ThisFile & ".xlsm", FileFormat:=52
End Sub

View 1 Replies View Related

Macro - Hold View And Avoid Confirm Delete Message

Feb 11, 2009

1. I can't remember it, but I know there is a command so that the view hold and that the selected tabs and cells does not show and the same view remains until the "unhold" is called in the macro. THEN the view is updated. What is this command again? Could not find it...

2. The macro needs to delete tabs at the click of a button (easy part) but for each deletion, a message appear:

Data may exist in the sheet selected for deletion. To permanently delete this data, press Delete. Is there a way to prevent the message from popping out when the macro is executed?

View 2 Replies View Related

How To Confirm Whether Particular Value Exists In Range

Jun 4, 2012

How I can confirm whether a particular value exists in a range. i.e.

ABCD11Yes/No22

Does the Number 4 exist in the range

A1:A8?334455667788

View 3 Replies View Related

Search And Confirm Function Setup?

Aug 19, 2013

I have to do a project, but I'm not really sure how to go about it. Here's my problem: I have about 200 stock ticker symbols already given(ie. AAPL, MSFT, NEE, etc...), and i have to create an excel file where i would copy/paste or enter in another set of stock ticker symbols and would give me back the answer if any of the newly entered symbols match the ones i already have(either in form of 1 or 0, YES or NO etc...).

View 4 Replies View Related

Confirm Save As - Change Default?

Jan 5, 2014

Whenever updating an Excel file and saving it as a new file, a "Confirm Save As" window appears. The default is "NO" (No is Highlighted). Conversely, in MS Word, the default is "Yes" (and, YES is highlighted). I would like to change the default from NO to YES in Excel.

View 1 Replies View Related

Ask User To Confirm Delete Action

Jun 18, 2014

I'm trying to prompt user when he tries to delete a value from a cell so he can confirm is action but not the same way to all cells.

Let's say that I have cells A1:F10 with values, and user should be able to change this values but not to delete them (can't be a blank cell) and I want to prompt him that info (something like "Cell can't be blank!").

In other range a want a different thing: let's say cells H1:K20. In this cells user should be able to change cells values and also delete them but I want to ask him for a confirmation (something like "are you sure").

View 7 Replies View Related

Pop Up Form Within Userform To Confirm Choice

May 11, 2009

pop up form within userform to confirm choice. I have a button within a userform that clears the form:

View 5 Replies View Related

Confirm True In Logical Test Using Find

Nov 9, 2009

I'm trying to use the following formula to verify if the "," is within a cell. Something is not right, because even for True conditions, I'm getting a False return. I think my True logical test is not written right.

View 3 Replies View Related

Avoid Message Box Asking To Confirm Deletion Of Worksheet

Jul 18, 2007

I've written some VBA which creates worksheets to temporarily store data in. At the end of the code I delete the worksheets. However, for some reason I am getting a message box which asks for confirmation. How can I avoid the user of my report having to click OK for each of the worksheets which need to be deleted?

View 3 Replies View Related

Compare & Confirm Dates In Column To Date In Cell

May 21, 2008

I am trying to do a macro that looks to see if the date is different from one cell to another going down in rows. I got it to work until the cell is empty then it says the date dont match but I just want it to stop the loop. so it should go down a list check to see if the date is the same all the way down the list, stopping if cell is blank, if not give a message box, if it is the same stop.

Is As follows

Dim rowNum As Integer, colNum As Integer, currCell As Range

rowNum = ActiveCell.Row
colNum = ActiveCell.Column
rowNum = rowNum + 1
'get first cell
Set currCell = ActiveSheet.Cells(2, 3)
'loop while cell not empty
Do Until currCell.Value = " "
If currCell.Value = ActiveSheet.Cells(2, 3) Then
If currCell.Value = "" Then
End If

View 4 Replies View Related

Macro Stops Running The Macro Completely And Hangs In The Middle

Jul 3, 2007

Here in our department we made a pretty elaborate macro that takes a report and sorts them out to 17 different sheets in a one workbook. This Macro pulls a file from a specific location on our server and then opens the CSV sorts it out color codes all the important information and saves it back onto the server under you specific initials.

They are four PC's along with our Managers laptop that run this Macro daily.

About 3 weeks ago my Managers laptop stops running the Macro completely and hangs in the middle of the whole thing. Eventually crashing Excel.

We try to remove the modules and re-import them back into the personal macro workbork but this does not work. The Macro's did not change and still fully function on the other four desktops to this day.

I uninstall Office on my Managers laptop and reinstall. Import the Modules again and still hangs up in very same spot it did 3 weeks ago.

I've tried to lower the macro security to the lowest level also and I've still had no luck with this laptop. I don't understand. The Macro's function perfectly on other PC's but will not function on this laptop.

View 9 Replies View Related

Running A Macro When A Value Is Reached In A Specific Cell Used To Call Up Macro

Jan 7, 2009

I have a Sheet sheet1 and I want to run a macro when the cell D2 in Sheet1 is equal to 10,7,5,and 3. I only want this macro to run when those values are reached the macro then puts the data onto a sheet called wps. The macro is run as a module and is a sub macro.

View 9 Replies View Related

Running A Macro

Dec 19, 2006

Can i run a macro by just the pointer going over it.

View 9 Replies View Related

Running A Macro On Save?

Apr 10, 2014

I'm trying to get a macro to run when the user presses the save button. I have the following code:

[Code] .......

This code is supposed to apply the TRIM function to every worksheet in the workbook when the user presses save, and the saves the results. I understand the Private Sub bit is the code to have the macro run during the save, but for some reason the macro itself isn't actually running. I'm not getting any error message, its just that the cells which should have the TRIM function applied to them aren't being corrected.

View 4 Replies View Related

Progress Bar While Macro Is Running?

Mar 10, 2014

I have a macro that takes about a minute to run. I would like to add a progress bar to appear once the macro starts running. There are no loops in the macro. What are my options?

View 3 Replies View Related

Running Private Sub From A Macro

Mar 17, 2014

I have 3 different sheets with a private sub on each all labelled

Private Sub CommandButton1_Click()

The macro's runs fine on each page.

I want to put a macro on a separate sheet that i can run each of those macro's

I did initially copy the original private macro and change the

Private Sub CommandButton1_Click()

to

sub report()

But I couldn't do all 3 in the same manner. i did change each name to something different... the other 2 subs did run, but they didn't do anything except put the massage box on the end saying that "the macro has finished".

The private macros are on sheets 26, 28 and 12.

View 3 Replies View Related

Running Macro In Different Workbooks

Mar 25, 2014

I have 7 different workbooks as part of my daily routine.

At present the first workbook is opened via the task scheduler, and the macro is run using the following code

[Code] .....

This then opens the next workbook and closes the current one. The next workbook then runs its macro again from a timed call

[Code] ...........

This repeats for 7 workbooks. The problem is, if a macro overruns - the whole schedule is out of sync when macro's are called depending on the time. What I would like to do, is link each macro by calling for the next one, and closing the current workbook. However, when i have tried to do this, the macro has always stopped when the workbook has been closed - the next macro doesn't run.

View 2 Replies View Related

Slow Running Macro

Oct 3, 2007

Below is the entire code that I am using. It is a simple routine which checks whether a part has started its release process or not, based upon dates. The code works and does what I want.

The problem that I have is that it is very slow, for example it takes 35 seconds to go through 530 lines items. In my (limeted) experiance, based on other VBA doodlings this slow.

View 9 Replies View Related

Running A Macro From A If Statement

Jul 28, 2008

Is it possible to run a macro from an IF command?

View 9 Replies View Related

Running Macro Every 20mins.

Oct 8, 2008

I already have a macro made named (PowerPoint) that is saved to the wookbook. I am looking for a way to have this run every 20min. I have tried several differnt things and it did not work. Here is one I found online. I only need it to run when it is open and every 20mins. as long as I have it open.

View 3 Replies View Related

Running A Macro From A Different Workbook

Dec 18, 2008

I have 2 workbooks (Workbook1 and Workbook2).

Workbook 1 contains a button, that calls a macro. This macro calls a macro from Workbook 2.

For this, I am using the Application.Run function.

The Macro in Workbook2 is a simple one line macro that updates cell A2 to a value of 6.

Range("A2").Value = 6

This works fine!

However, I want the the cell A2 in WORKBOOK1 to change to 6, not the cell in Workbook 2.

To add an element of difficulty, Workbook 1 could have any name (I won't know what it is, as the user could change it).

How can I get the Macro in Workbook 2 (Called from Workbook1), to update the cells in Workbook 1.

View 12 Replies View Related

Macro For Running Solver ...

Jan 11, 2009

I have a problem with a macro in Excel 2007. It invokes
solver and creates an answer report. Please find the VB
code for macro, below.

View 7 Replies View Related

Confirmation Box Before Running A Macro

Apr 8, 2009

How do I ask for a confirmation box before running a macro, but only one time. What I mean is some of the macros I use loop and it wouldn't be practical to click on "ok" for each time the macro ran.

So again I just need some code to tack on to the beginning of a couple of my macros that will ask me before they run but only once.

View 11 Replies View Related

Macro Running Very Slow

Jun 11, 2009

I have the following macro in a worksheet...and it is running very slow. There are other macros in the worksheet and they all run very well. Any ideas by looking at this code why it would be so slow in running?

View 7 Replies View Related

Macro To Stop Running At Last Row

Aug 10, 2009

I have a spreadsheet containing a macro to automatically sum values from week to week and display the max/min and average. This is almost fully working. The problem I have is the macro copies the sum formula down the page and doesn't stop at the last row. It always adds one or two extra rows. The formula should stop at row 77 however this does not happen and therefore the sum keeps going. Which in turn, distorts the max/min figures.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved