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


ADVERTISEMENT

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 View Related

Calling Macros Via Dropdown Box

Jun 20, 2007

I have a list of about 50 items sitting in a Data Validation dropdown list in an Excel cell, and I want my vba code to run every time the user makes a new selection. How can I do this?

View 2 Replies View Related

Calling Macros For Items In Combobox

Feb 9, 2014

I am trying to run macros for each item in combobox. These macros will insert text in a cell. The problem is that when i make a selection from combobox, save the file and reopen the file, it again runs the macro based on the value in combobox. I am getting the results twice in a cell.

I've written the following code.

[Code] .......

View 5 Replies View Related

Validation List Calling Macros

May 18, 2007

Newbie user of VB. I need some assistance on a project. I have a form that uses a validation list ( cell c5) to populate other cells (c6, c7, c8, h5) using Vlookup.

This part works fine. On the list is an "other" choice which I need to initiate a textbox macros which would accept user input and populate the same cells with the entered data once a cmd button is selected. I’ve tried redefining my variables as ranges or strings with the same inconclusive results. The code as it stands looks like this:

Private Sub Worksheet_change(ByVal Target As Range)
Dim Vname As String
If Intersect(Target, Range("c5")) Is Nothing Then
'do nothing
Vname = Target.Value
If Vname = "" Then
'do nothing
If Vname = "Other" Then Newvendin.Show
End If
End If
End Sub

Using this code doesn’t initiate the event.

Newvendin is the userform to enter new data only if “other” is selected. CmdEnter is the enter button on the userform with textboxes in it. I’m having a bit of trouble with it’s code as well.

Private Sub cmdEnter_Click()
Dim ws As Worksheet
Set ws = Worksheets("OSP Parts List")
ws.Cells("c5").Value = Me.Vname.Value
ws.Cells("c6").Value = Me.Vadd1.Value
ws.Cells("c7").Value = Me.Vadd2.Value
ws.Cells("c8").Value = Me.Vcont.Value
ws.Cells("h5").Value = Me.Vphone.Value
End Sub

The Vxxxxx are the textboxes.

I get type mismatch errors using this code.

I would like it to populate the value typed into the textboxes into the indicated cells.

Final question and it’s probably stupid. If you have more than one Private Sub Worksheet_change(ByVal Target As Range) sub on your worksheet, how do you change the wording on each so that it won’t cause an Ambiguous name detected error?

View 5 Replies View Related

Run Macros Selected In A MultiSelect List Box

Jan 20, 2008

"I have 2 listboxes 1st listbox is listing all macros in sheet user can select macro which he intend to run and transfer them into another listbox
once he have selected all macros he want to run just press commanad but to run
it will pick all macros from listbox 2 and strat running them one by one"

View 3 Replies View Related

Encourage Enabling Of Macros: Disable Macros When Opening Then The Worksheet Menu Bar And Other Command Bars Are Still Available

Aug 26, 2009

I have an Excel 2003 program that contains macros. One of the macros hides certain command bars and disables the worksheet menu bar. On close the opposite is true. The problem is, if a user uses the disable macros when opening then the worksheet menu bar and other command bars are still available. I would like to hide all of the data sheets and display another sheet that would normally be hidden displaying a message that the macros have to be enabled for the program to work correctly if disable macros is chosen. When the enable macros are used I would like the Error page to be hidden.

View 6 Replies View Related

Enable/Disable Macros When No Macros Are Present

Jul 28, 2008

I have a user that keeps a maintenance log in an Excel worksheet and sends an updated copy once a week to a board member. Two weeks ago, the board member started complaining that he was prompted to enable/disable macros on opening and became worried when my user stated that no macros were used in the book. He is now concerned that we have sent him a virus.

I know the file is clean because I've scanned it, and when I look at the file in VB, there are no modules or classes present just the Sheets 1-3 and the ThisWorkbook file. None of these objects have any code in them. My user does have some macros in PERSONAL.XLS but they are not used in the workbook in question.

No one else gets the prompt for enabling/disabling macros. Even if I set my security to prompt for any macros, I get no message. I'm convinced that there must be some setting in his Excel that is causing this individual to get this message. Is there anything else other than a macro that would cause this?

View 9 Replies View Related

Fill Range Of Cells With Text When Listbox Option Selected - Clear When Not Selected

Jul 25, 2014

I am using this code to hide or unhide rows of text on another sheet:

VB:
Sub ProcessSheet1ChangeOnCellJ7(ByVal Target As Range)

Dim sAddress As String
Dim sValue As String

'Get the address of the cell that changed without '$' signs
sAddress = Target.Address(False, False)

[Code]....

When the "Not Pursuing" list box option is selected (in cell "J7" or "J8" in Sheet 1) I need to add (or over-write) "Not Pursuing" to the range of cells in column "B" (in the "Tasks" sheet), but only for that particular Goal, meaning a limited range of cells in column "B". If the "Pursuing - Show All Tasks" option is selected for a Goal then these same cells need to be blank so that the appropriate person can enter their name into the cell.

The purpose for adding "Not Pursuing" automatically to these yellow highlighted cells is that it will facilitate filtering of tasks by individual in the "Tasks" sheet..

Again I have tried several times to upload a sample file and am unable to, which I know makes it more difficult to solve. (Is there some common mistake people make? I know it's an allowed format and is very small in file size....)

Code solution can be entered directly beneath:

VB:
If Target.Value = "Not Pursuing" Then
ActiveWorkbook.Sheets("Tasks").Rows("29:29").EntireRow.Hidden = False
ActiveWorkbook.Sheets("Tasks").Rows("30:48").EntireRow.Hidden = True

View 1 Replies View Related

Elseif Statement In Vba: If The Selected Cell Falls Between 1/01/06 And 31/01/06 Then Jan Would Be Selected

Oct 10, 2006

Basically it is a if statement saying that if the selected cell falls between 1/01/06 and 31/01/06 then Jan would be selected. The end part is not a problem; I’m just not sure how to write the one line of code that would test if the cell falls between the two dates. I attemped to create it as shown in the code attached below but wasn't successful. I used an else if statement to test the other 11 months.

Sub test()
Dim SelectDate As Range
Set SelectDate = Range("SelectedDate")
If selectedDate >= 1 / 1 / 2006 And selectedDate <= 31 / 1 / 2006 Then
ActiveSheet. PivotTables("PivotTable1").PivotFields("PnLDate").CurrentPage = _
"Jan"
ElseIf selectedDate >= 1 / 2 / 2006 And selectedDate <= 28 / 2 / 2006 Then

ActiveSheet.PivotTables("PivotTable1").PivotFields("PnLDate").CurrentPage = _
"Feb"........................

View 4 Replies View Related

Calling The Min Row To Another Row

Oct 22, 2007

i have 5040 rows in a sheet. in columns A,B,C,D,E,F, i have some input. and based on that i have some formula on column G.

lets say, min value is at row 4094 by looking at G column... i want to call entire row to the, lets say K L M N O P ....i need a formula for that....

random numbers are included in the formula. So ever time i make any changes on the sheet, min value changes even thought i dont play with the formula and input... so i want my new min value shown at row 1 of K L M N O P, every time i do that

how can i do that?

View 11 Replies View Related

Calling One Sheet From Another

Sep 26, 2009

I am creating a set of lists, each on a different sheet. I want to have the first sheet as a sort of "Title Page" with basic information from the others. Is it possible to create a link of some types so that I could click on "Magazines" for example and go to the sheet called Magazines, or "Books" and go to the sheet called books. The latter would be very handy as this workbook has around 30 sheets in it, which is a pain to look through to find the right one.

View 2 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/using An Array

Apr 15, 2009

I have to do the same procedure for a number of profit centers. The only differences are the names of these profit centers. Therefore I want to use the same code, with changing references. How can I use this array so that it calls/uses 1 profit center at the time? If I use the following code they all are used at once (P1100P1200P1300P1500P1600P1900)

View 2 Replies View Related

Calling A Sub With A Formula

Jun 22, 2009

Is there a way to call a sub with out actually saying its name? In other words can I refer to a sub by a value or a cell that holds its name? for example, in my CNC programs I often use something like this;

View 14 Replies View Related

Calling UDF Inside VBA

Jan 20, 2012

Okay, I know you can reference worksheet functions with code like:

application.search()

But how do you use a UDF function within VBA???

I tried, thisworkbook.UDF() (UDF being the name of any UDF) but it didn't work.

View 3 Replies View Related

Calling A Form From Add-in

Mar 13, 2012

I have a add in for excel (self made) and I recently hit a wall when trying to add functionality to it.

I have a form "UserForm1" created within the .Xlam file of the add in.

I want this form to be useable for any excel file that might be open, so putting code in the excel file that needs to use the form is undesirable.

The functions carried out by my add in are activated trough ribbon buttons.

my goal is to have a button on the ribbon that loads the form.

As the UserForm1.show code doesn't work, I will need a alternative.

I did find the code for making the sheet show if there would be a button in the workbook, however I want all code to be in the add in.

View 4 Replies View Related

How To Loop Instead Of Sub Calling Sub

Mar 17, 2012

I am using the following code to find the text "Employment" in any row in colum H. If found it copies it to another worksheet.

Sub CopyRowsSht8()Sheet8.SelectSet Rng = Sheet8.Range(Sheet8.Range("H1"), Sheet8.Range("H" & Rows.Count).End(xlUp))For Each cell In RngIf cell.Value = "Employment" Thennum = cell.RowSheet8.Range("A" & num & ":" & "L" & num).Copy Destination:=Worksheets("Employment").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)End IfNextCall CopyRowsSht9End Sub

1. This sub calls CopyRowsSht8 and then this calls CopyRowsSht9 and so on. I have 15 sheets so how would I code this into some kind of loop to include sheets 8 to 22 instead of calling sub then sub then sub etc.

2. It takes a while to do just two sheets so 15 would be very slow - can this be made faster. The maximun number of rows containing data is only about 100 on each sheet -could that make a difference?

View 1 Replies View Related

VBA Calling Another Subroutine

Mar 14, 2008

Im trying to call another subroutine within the same workbook but it doesnt work,

---------------------

Sub Macro1()

Dim mac1 As Variant
Dim mysub As Variant

Select Case Cells(1, 3)
Case mac1
Call mysub

End Select

End Sub
---------------------

View 9 Replies View Related

Calling Variables

Apr 14, 2009

The below thing has been driving me up a wall for 2 days now. I know the fix has to do with calling the variables, but I can't figure out the exact code.

Sub Parsing_Logic()
Dim IBG_URL As String
Dim A As String
A = Mid(IBG_URL, Application.WorksheetFunction.Find("/200", IBGURL), 8)
Dim B As String
B = Left(IBG_URL, Application.WorksheetFunction.Find("/200", IBGURL))
Dim C As String
C = Right(IBG_URL, Len(IBG_URL) - (Len(A) + Len(B)))
Dim D As String
D = Left(C, Application.WorksheetFunction.Find(".200", C))
End Sub

Function IBGLink(IBG_URL As String, Formatted_Date As String)
If Application.WorksheetFunction.IsErr(A) Then
IBGLink = (D & Formatted_Date)
Else: IBGLink = (B & Formatted_Date & D & Formatted_Date)
End If

View 9 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 A Function

May 1, 2007

I guess I just don't understand the basics of calling a function. I have the following function in a standard module:

Function CleanUp(ws As Worksheets)
ws. Range("A2:P100").ClearContents
End Function

I have this code in a worksheet module:

Sub Trying_to_call_a_function()
CleanUp (ThisWorkbook.Worksheets("Month End"))
End Sub

But when I run the routine that calls the "CleanUp" function, I get the message: "Object doesn't support this property or method." I have tried changing the Function to this: CleanUp (ws as Worksheet) [instead of (ws as WorksheetS)]. Yet, this does not change anything.

View 3 Replies View Related

Calling A Subroutine

May 23, 2007

Is calling a subroutine within another different than running it from the play button in the VB editor? I am getting different results.

I have the following code that I want to call from another subroutine that creates a series of command buttons.

Sub DynamicButtons()
Dim ButtonCount As Integer
Dim ctl As OLEObject

' Create the Button objects
ButtonCount = 0
For Each ctl In Sheets("Sheet1").OLEObjects .............

View 9 Replies View Related

How To Delete Another WorkBook Macros Using Macros

Jul 23, 2005

What is the commands or script for deleting a macro automatically using
another workbook macro.

View 9 Replies View Related

Hiding Macros From The Run Macros List

Jul 14, 2008

Is there a way to hide a macro from the list where you choose which to run, but not in the VBA editor? The userbox I just created calls upon 2 different macros, and has a macro to bring up the userbox. I need a way to hide the macros in Module3 from selection, but keep the macros in Module4 available to choose to run.

View 9 Replies View Related

Calling Columns Into Different Worksheets

Nov 4, 2008

I'm not sure whether this should be a general question or it should go in the programming section... but here here goes anyways

I need to create a spreadsheet where the contents of Col A & B in Sheet1 are copied into both Col A & B in Sheet2 & Sheet3. Sheet1 Col A&B will be continuously updated (rows will be added) and as these columns are updated, Col A & B in Sheet2 & Sheet3 should be updated automatically and keep the format that is set in Col A & B in Sheet1.

Now, Col C&D in Sheet2 & 3 will be updated by a different user. As the user updates the cells in Col C&D in Sheet2 & 3, Col C&D in Sheet1 should automatically be updated with the data in the cells of Col C&D in Sheet2 (and keep the format) and Col E&F in Sheet1 should automatically be updated with the data in the cells of Col C&D in Sheet3 (and keep the format).

View 12 Replies View Related

Calling Non-existing Sheets

Oct 28, 2009

Currently I'm trying to set up a table that referneces sheets that don't yet exist. These sheets will be added by the user or by macro, either one. I want my table to automatically take these pages into account when they're created without having to rewrite my formulas. The problem is that when I make the call to a sheet that's not there, it opens a file open dialogue box and I don't want it to do that. Is there something I can do here about that?

I don't think it's really going to shed any light on the subject, but this is my call (from memory, not copy and paste)

IF(OR(ISERROR('P01'!N2),'P01'!N2 = ""),"",'P01'!N2)

Also, when I enter this formula and the sheet doesn't exist, it automatically reverts to a text field and I have to manually switch it back to general in which case it gives a #REF error (which is just fine).

Also, I'm writing it in Excel 2003, but it completely crashes Excel '97 if I try to open it there, how can I fix this?

View 6 Replies View Related

Calling Routine From A Class In Add-in?

Feb 4, 2014

I've got three workbooks that end users will be using for data entry. The VBA code for the three workbooks is identical.

I'm trying to encapsulate the code into an add-in so I only have one copy of the code that I have to debug/maintain.

Furthermore, I've also encapsulated the code in the add-in into a class. The class isn't really a "usual" object modelling some data; rather, it's a utility class processing Worksheet_Change and Worksheet_Activate events. Hopefully this isn't a really bad idea, rather than keeping the code in standard modules in the add-in.

The application is called "Midas". Here are some code excerpts:

Midas.xlam:

Standard Module:

[Code] ......

Class Module:

[Code] .....

And in the end user workbook:

[Code] .....

The Wbk_SheetChange event handler is triggering, but it's looking for the code in the end user workbook, instead of the class. Is there a way I can change

[Code] .....

to call the private routine "Cases_Changed" (where "Cases" is the sheetname) residing in the class instead of looking for it in the workbook?

View 4 Replies View Related

Calling Variable From Userform

Aug 13, 2007

Hi, i'm having a terrible problem (at least for me).

I want to use a var from a UserForm to use it in calculation method in a Module.
How can i refer to that variable in the Userform in the Module code?

View 11 Replies View Related

Using Variables And Calling Subs

Aug 19, 2008

I'm having some trouble getting to grips with using/calling variables and other sub routines.

View 9 Replies View Related







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