Macro To Select VbYesNo When Calling Another Macro

Apr 20, 2008

I have a workbook with a 2 macros "PopulateSheetlist" and "SaveEditedversion"

Normally they are each button operated, and prompt the user with vbYesNo style options. I wanted to write a Macro, say "Macroautomatewkbk that would automatically answer the prompts.



Sub Macroautomatewkbk ()

Call PopulateSheetlist

' Always answer YES or OK to any prompts this macro may offer

Call SaveEditedversion

' Answer No for the 1st prompt and YES for the 2nd prompt

End Sub

MsgBox "Both macros "PopulateSheetlist" and "SaveEditedversion"

' Some error handler here, don't know how this should work exactly.
Could any one please explain how to fill in code in the commented sections in the above sample code?

Edit: I tried recording a macro to do the above, but it only showed the zooming and scrolling that occurred, none of the button prompts being answered.

View 9 Replies


ADVERTISEMENT

Vbyesno Only Calling One Of My Selected Macros

Aug 26, 2008

I have this macro to ask the user of the form if he/she is the QC person:

Sub QCFIN()

If Sheet2.Cells(70, 1).Value = "x" Then
MsgBox "You Must Save to Your Own Claims Folder First (Follow Step 3)!" & vbCrLf & vbCrLf & _
"-Formbot-" & vbCrLf & "* _ *"

ElseIf Sheet2.Cells(70, 1).Value = "" Then
x = MsgBox("Are you the QC Person Today?", vbYesNo)
Select Case x
Case 6
Call Save_Network_2
Call QC_Finish
Call DBCOPY
Call DBCOPY2
Case 7
MsgBox "email the claim to your designated QC person"
End Select
End If
End Sub
The things works, but if the user selects "yes" it only calls the first macro, "save_network_2"

View 9 Replies View Related

Suppress MsgBox When Calling Macro From Another Macro

Jan 9, 2012

I have a workbook with two macros that the user can run individually. They unfortunately take a fair amount of time to complete (approx 1 hour each) so I implemented some timing related code that at the end of the macro completion, it notifies them with a msgBox indicating how long it took to run. With that said, I would like to allow the user to run a macro that simply calls the other two so that they can kick it off at the end of the day and they both will be finished by morning. I created a new macro that simply makes a call to each of the other macros individually. The problem is, my msgBox that displays after the first macro completes, waits for "OK" acknowledgement which defeats the whole purpose of being able to run them both via one macro. I have tried to include Application.DisplayAlerts = False prior to calling the first macro but it is not working. Here is an example of what I am trying to do.

Sub runAllMacros()
Application.DisplayAlerts = False
Call compileBookData
Call compileLaborData
Application.DisplayAlerts = True
MsgBox "All Rollup Macros have completed execution."

View 5 Replies View Related

Calling A Macro And Formula Macro..

Aug 13, 2009

I created two macros. One for refreshing the data I pull from a database, and another one adding some formulas I need. On the formulas macro, I don't know how to have it automatically fill until the last row of data to the left of the column with the formula. (Just like if I double clicked it and it filled down automatically). I also tried to combine these two macros, but I get errors and they don't execute.

View 3 Replies View Related

Calling Macro From Add In

Feb 12, 2009

I have created an XLA using a blank workbook which has a macro (called CompareMan) I have written within it.

I have written a utility (called INSTALLMAN) to install this add in.

When I run the install it creates and activates the add in OK.

The install also creates a toolbar with a button to trigger the macro.
Problem is, when I click the newly created button, no matter which workbook I am currently in I get a message ...

"The macro INSTALLMAN.xls!CompareMan cannot be found".

So my question is, how do I get my button to trigger the macro in my add in?

View 14 Replies View Related

Calling Another Macro

Aug 4, 2006

I am trying to call another macro, but instead of using the name of the macro, I have it in a variable. I am getting an error that says "Compile Error: Expected sub, Function, or Property." Can you call a macro that is in a variable? I basically have a bunch of macros created. I also have a list of the name of those macros on a worksheet in Excel. I want excel to start at the top of the list in excel and run the macro, then move down and run the next macro, and so on. Below is my code.

Sub Commercial_2005()
Dim Macroname As String
Workbooks("bleeg.xls").Activate
Worksheets("CommercialList").Select
Cells.Range("a1").Select
While ActiveCell.Value <> ""
Macroname = ActiveCell.Value
Workbooks("copy of recast_Report_v2.xls").Activate
Call Macroname
Workbooks("bleeg.xls").Activate
Worksheets("CommercialList").Select
ActiveCell.Offset(1, 0).Select
Wend
End Sub

View 3 Replies View Related

Calling Macro From Different Workbook

Nov 14, 2006

I have a set of eight files, each of which is refreshed daily through a macro. I wanted to set up a master macro in a separate file that would open up each of the eight in turn, calls its refresh macro (which saves and closes the workbook), and then open up the next one, etc. I've searched the board and Help on this subject, but I keep getting an error:

Sub UpdateCSHoldReports()
' A sub to update all the US CS Hold Reports

' First, change the directory to the one that holds the files

ChDir "s:Marketing_ReportsCustomer Service2006CS Hold ReportsUSA"

' Next, open each file in turn, and run its refresh macro
' The refresh macro saves and closes the file automatically

Workbooks.Open ("VERIFICATION HOLDS 1000 PLUS.xls")
Workbooks("VERIFICATION HOLDS 1000 PLUS.xls").Activate
ActiveWorkbook.Sheets(1).Activate
Application.Run ("VERIFICATION HOLDS 1000 PLUS.xls!V1000Refresh")
End Sub

I'm only working on one file right now; I'll add the others when I get this one going. The error message I get is "1004" "The macro VERIFICATION HOLDS 1000 PLUS.xls!V1000Refresh cannot be found." It occurs when the Application.Run statement attempts to execute.

What obvious thing am I missing here? I have checked all the spellings, etc., so it's not something like that.

View 9 Replies View Related

Calling A Macro In Another File

Nov 19, 2009

I'm writing some code in a "control" Excel file that will open a series of other files and successively run some processes. Each of these files has its own unique "refresh" macros, with parameters that vary from file to file.

How do I put code in my "control" file that will, when it opens each of these other files, run the "refresh" macro that is contained within them, and not the "control" file itself?

View 9 Replies View Related

Calling Macro's From Another Workbook

Nov 26, 2009

I have been combining multiple macro's into one large Macro and after research, it seems that only the call function works without any hitches.

Is there a way to use the call feature in one workbook while the macro's themselves, 5 or 6 of them, are in another workbook that is closed?

All users would have access to both workbooks.

The reason I am trying this is because I do not want all the other users to have to choose between multiple macro's and some of my colleagues like to use a radio button to link to the workbook. so it needs to have one file in it...

View 9 Replies View Related

Calling Macro Numerous Times?

Jan 24, 2014

At the moment I have a macro that is assigned to a button. When clicked, it creates a newline, create and copy a column in another sheet. This code works fine :

[Code] ......

What I now want to do is make a cell called "Total Number of Sites" and allow user to input data into "D3" manualy. eg if 3 sites, user input 3 in D3 so D3 = 3.

Since total number of sites = 3, Instead of clicking that button I made 3 times, I want to call the macro 3 times using a nother button.

However it doesn't work. This is what I used:

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

View 5 Replies View Related

Calling An Image Alt Text For Use In A Macro?

Aug 19, 2009

I'm hoping there is some way to call whatever text is stored in the "alt text" field of images placed in an excel sheet for use as a variable / string reference in a macro.

The "alt text" will not be changed in any way by the macro.

View 10 Replies View Related

How Do I Obtain The Name Of The Form Calling Macro

Nov 21, 2007

I've assigned a single macro to numerous Form Checkboxes (not ActiveX). I'd like the macro to be able to identify the Checkbox calling it, so that if for example, if it were fired by clicking "Check Box 41", the macro should know that.

Is this possible, or must I use an ActiveX control?

View 9 Replies View Related

Return From A Macro To The Calling Worksheet

Jan 6, 2009

how I can go back to the worksheet I was in before I branched off to work in another worksheet via a macro?

I know you can tell the macro which worksheet to go to, but not sure how to get vb to remember where I was and return to the same sheet (or even cell).

View 9 Replies View Related

Looping Through Each Worksheet And Calling A Macro

Jan 13, 2010

I had create a few macro with the macro name the same as the worksheet name.

How can i create another macro to loop through all the worksheet and if there is any data in Cell A1, it will call the corresponding macro. If there is no data, it will go onto another worksheet.

View 9 Replies View Related

Calling Macro: API Postmessage Or Sendmessage

Oct 4, 2006

Using a different script application, I would like to run my VBA macros while working in Excel. I was wondering if I could achieve that using PostMessage or SendMessage calls. Part of the problem is that Excel only seems to allow either Ctrl + letter or Ctrl + Shift + letter as an assignable macro shortcut. My script gives me flexibility in that I can assign any key or combination of keys to trigger any kind of routine, like a PostMessage call, for instance. So while working on my workbook, I might want to press, say, ScrollLock followed by a letter of my choice, followed by another letter of my choice (a sort of super shortcut), resulting in the running of a Macro of my choice in Excel.

View 5 Replies View Related

Calling Macro In Another Workbook And Carrying Some Variables Back And Forth

May 22, 2013

I have a macro running in a workbook that gathers some data (a date, a string and a few arrays). Towards the end of this macro, I need it to open another workbook and run a macro that sits in this other workbook, using the data from the first workbook. I then need it to return some results (several integers) back to the first macro to be pasted into the first workbook.

I gather that I can't use 'Call' as the second macro is in another workbook.

I've found that I can use Application.Run but I'm unsure how to carry variables back and forth using this.

How to move the variables between macros / workbooks using the Application.Run option, or maybe another way of doing things?

View 1 Replies View Related

Excel 2000 :: Macro Calling Unrelated Function?

Jun 9, 2014

the macro works fine until it executes the paste values. At that point, the macro jumps to the "CountThem" function which is located in another workbook. The data that I am copy/pasting is in no way connected to any cells that are using that function. Although, other values in the workbook are passed down from data that uses that function.

I am still in the dark ages using Excel 2000.

This is the code for my macro.

Code:
Sub Current_to_Raw()
'
' Current_to_Raw Macro
' Macro recorded 2/12/2014 by
'
'
Range("N14").Select

[code]....

View 2 Replies View Related

Pause Macro - Select From A Drop Down - Restart Macro

Dec 18, 2007

I am trying to pause a macro on a protected sheet, select 2 adjacent cells (initially protected), utilize an existing drop down box to select a name from the list, copy the name from the list into the range of cells, then re-start the macro.
I had no problem when there was just one name (see John Smith below). I tried to use the InputBox command but needed to actually type in the name.

ActiveSheet.Unprotect
Range("C27:D27").Select
'ActiveCell.FormulaR1C1 = "John Smith"
' Application.CutCopyMode = False
' ActiveSheet.Paste
'Range("c27:d27") = InputBox("Enter value")

View 4 Replies View Related

Macro (Select, Sort And Select)

Nov 16, 2006

I need to get a macro to select all the data in column "A", sort it in ascending order, omit the blanks if any, then select (highlight) all the data so that another macro can be run.

When I record it, it will only record up to the last row I highlight but the data always changes so there could be more or less.

View 9 Replies View Related

Select To Last Cell Macro

Dec 19, 2006

I used to do some VB stuff several years ago, but it's unfortunately not exactly like a bicycle and I'm having a hard time remembering what I'm needing to do.

I have several functions in my macro which are supposed to select an entire column of data and do various things with it, from cutting & pasting to combining data from multiple text cells. Also it's got to input in one column, a text string "CIS". Anyway, if I tell it the whole column, then it winds up overflowing beyond what I need, and I really only want it to affect as many rows as have data in the spreadsheet.

Here's the data:
'Unlimited Range K here', that's where I want it to select to the last row of data for the range.


Sub ComputeCSV()
'
' ComputeCSV Macro
' Macro recorded 12/18/2006 by Matthew Roberts
'
' Keyboard Shortcut: Ctrl+l
'
Columns("G:G").Select
Selection.Cut
Columns("B:B").Select
Selection.Insert Shift:=xlToRight
Columns("G:G").Select
Selection.Cut

View 12 Replies View Related

Select All Rows In A Macro

Nov 11, 2008

I need to create a new macro that will select all rows that have data and create a (3) pivot tables.

I have tried to create macros that will create a new tab and populate the pivot table. I keep getting an error that says "subscript out of range", so instead of creating the tab during the macro I have created the tabs as part of the template.

Again the problem is when running the macro with more rows, the macro doesn't recognize the additional rows. Ctrl + A is used during the macro but is hard coated for only the number of rows it selects, Ctrl + A twice is giving me "blank" data in the pivot tables. I have attached a sample sheet with 14 rows. Next month there may be only 10 rows or 50 rows. I have macros created for the pivot tables to view.

1: How can I create a macro to select all rows with data?
2: Can I create 1 Macro to create all 3 of the pivot tables needed?
3: Can the macro also create the tabs during the execution of the macro?

View 7 Replies View Related

Select Which Worksheet To Run Macro On...

Nov 19, 2008

I think this may be a little difficult (for me at least!) but would it be possible to have a list of the open workbooks popup when I run my macro, so that I may select which workbook to run it on?

The macro itself just does some formatting of the sheet, but it is contained in a master file.

View 5 Replies View Related

Using Macro To Select Cell

Feb 25, 2009

Can anyone help me to write a macro to select certain cell depending on a value in other cell.
I.e: If cell A100=1, then select cell B1, but if cell A100=2, then select B2, and so on.

View 7 Replies View Related

Run Macro To Select Cells With Value =1

Mar 2, 2009

I have a need and thanks in advance to everyone who can help me with this: Run a macro to copy from cell B2 in worksheet2, then paste that into every cell that has the value = 1 in worksheet1.Range("B2:Z40"). Cells in range B2:Z40 will be updated each week with the value varied from 1 to 10.

View 5 Replies View Related

Macro To Select An Invoice

May 5, 2009

Testing to see if this works ( ignore the multi posts, forum had a problem )

I basically need a macro to select whats inside the blue border area and print it.

I plan to include a button next to each invoice so i can just click the button and have it print the adjacent invoice.

View 9 Replies View Related

Find Then Select Row Macro

Aug 27, 2009

Is there any way to create a script or macro to "find" a number from column A that is in column B, then select it that row? Then it willl repeat that process with the next number in column A until the end....

View 14 Replies View Related

Macro To Select A Combo Box Value?

Sep 30, 2009

i need is a macro that once run selects a certain (or multiple) comboboxe's values. Eg I select macro 'test' and it selects value 1 on combo box 1, value 2 on combo box 2 etx..?

View 2 Replies View Related

Macro To Select Worksheet

Nov 19, 2009

I have a workbook with around 350 worksheets. A column in the main sheet contains a list of part numbers which correspond to the names of the worksheet tabs. When a cell on the main sheet containing a part number is selected I would like a macro to find the corresponding worksheet, move that worksheet to the end of the row of tabs and open it.

I am using excel 2007

View 12 Replies View Related

Macro Code For Select All

Jul 22, 2011

I record macro and hit select all and that action won't record. what's the macro code for select all in excel. i assumed it was the same as word

selection.wholestory

but it's not

View 7 Replies View Related

Macro To Select Certain Rows?

Jul 3, 2012

macro to select the header and rows below till the next header is reached if column L is less than column J for the whole sheet which can be up to 5000 lines or more. Then copy all of those to a new sheet. Here is part of the spreadsheet for a visual:

Product number
Name
Name
Finish date
Planned Qty
Mfg U/M
Lvl
Component
Name

[code].....

View 9 Replies View Related







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