I have a sub procedure that launches a hyperlink, but i have some conditionality so that if a cell (J3) is blank it pops up a message letting the user know they need to populate cell (J3). My problem is that if cell J3 is blank it pops of the message, but it still launches the link.
Sub NEWShyperlink()
Dim s As String
If Range("J3").Value = "" Then
MsgBox "Make sure you have entered the ticker symbol into cell J3!", vbExclamation, "Can not get News/Press Releases"
I know to exit a sub one uses 'Exit Sub', however I have a sub that is calling a second sub (within the same model), and if a variable is a certain value I want to exit...however, when I use 'Exit Sub' it exits the called sub, but then just continues from the original sub...it's not exiting it too. I can work a work around, but I'm wondering if there is a built in solution to this problem?
I have a procedure(try) which call two other procedures ( try1(),try2()) try1 - ask for a range of First cell try2 - ask for a range of Last cell
Now issue comes when user pressess cancel button for try1() it Exits try1() and goes back to try() and calls try2() but i want that if user pressess cancel it must also exit from try() too (calling function)
I would like to call upon a function until a certain criterion is fullfilled. Then, I would like to have the result returned to me and exit (all) open functions. For value1 = 1 and value2 = 10 I expect value1*value2 = 100. Instead, the routine returnz zero. What is the logical flaw in the code below.
Function testfunction(value1, value2) If value1 = value2 Then 'Calculating the difference testfunction = value1 * value2 Exit Function ElseIf value1 < value2 Then value1 = value1 + 1 Call testfunction(matrix1, matrix2) End If End Function
I have a macro that launches word or excel files if the file address (e.g. C:Documents and SettingsHenryDesktop est.xls) is typed into cell A1 by looking at the last 3 letters of the file name.
I cannot find a way to enable it to launch pdf files as well (e.g. C:Documents and SettingsHenryDesktop est.pdf)
I hide all Excel standard tabs and thus need a button on custom tab to record a macro. (I did this successfully with custom menu in Excel 2003.) In 2007 ribbon, I've reused the code for a button's OnAction, now going to callback that runs:
In Excel 2003, the stop button appeared automatically for me. But in Excel 2007, with hiding standard tabs, etc., I see no way to stop recording, other than running my button to return the Developer's tab, where the Record Macro button has changed to Stop Macro.
I'd like to either add a second button to my ribbon to stop recording the macro (but I can't find an idMso to use in a callback) or have my Record button change to Stop button, like Excel does. But I can't come up with correct code.
I have a worksheet that is a graphical display of a call floor with its cubicles. I am able to pop up a box with many details about the workstation in the cubicle (see Display pop-up box when cell selected) for more details, and would now like to go further with this application.
Our practice is to use VNC to review the end users' screens when they call us for assistance; given that I know the machine name and IP address, how can I start a VNC browsing session for the target machine?
My company uses database software called Business Objects. At the moment few people are using the program and its reports as they can't find the key ones or workout how to run them correctly. As everyone is comfortable with excel. I am creating a series of forms to guide my users to the key reports. I like this method because it is very user friendly and I can add lots of descriptions. Unfortunately my programming knowledge is limited to excel so I can't write a standalone program as you might suggest I do.
The problem: I want to launch the non-excel files using VBA. For example, a user will click on a "Customer" button to see a second form containing a list of customer reports. The user will then click on the button containing the name of the report they want to launch. I want the file to open. I tried using hyperlinks in an excel spreadsheet which works fine for opening the non-excel files, but it isn’t nearly as user-friendly or interactive.
I have a non Microsoft program file that I can open in excel. I usually make changes to the file; save it to its native format, then open up the non Microsoft program and open that file that I just edited in excel.
If I had to simplify it, using notepad as an example.
I open the TXT in excel and make changes.
Then Save the TXT in a folder location.
Open Notepad.
Browse to the folder Location.
Open the edited file.
I did not know if there was a quick VBA that I could use to get this to work?
Set wbABC = Workbooks.Open("C:ABCwithMacro.xls") Call abcMacro 'this macro is stored in ABCwithMacro.xls 'error - sub or function not defined on 'call abcMacro'
I have a list of URLs and I wrote a small VBA code to launch them when the user clicks on a button, however, it launches in Internet Explorer. Is there any way to get it to launch in Firefox instead?
'// Change rootpath here strRootPath = "J:MyDirectoryWilliams,Bob 7264"
PID = Shell(strExpExe & strArg & strRootPath, 1)
End Sub
The problem I have is that once I have done this a number of times (probably somewhere between 80-100 times then I notice windows explorer starts to play up as if running out of memory. A reboot soon fixes that, however, I was wondering if there is anything I can add to the code to keep it from hogging up memory...if that is even possible.
When I say 80 - 100 times, I don't mean opening up 80 - 100 instances of windows explorer. I mean launching windows explorer, moving some files then closing that instance of windows explorer. Then coming back into excel and repeating that process.
Each time I click on an Excel file the worksheet will open up within an existing Excel worksheet that I have open. This is frustrating when you are working with two monitors or screens (laptop screen and additional monitor) and want to view each worksheet separately in separate screens. What I end up doing, which is not efficient, is I'll open the second worksheet which will open up in an existing worksheet that I have open and then I'll close it, and then launch a separate Excel worksheet and pull open the recent file and I'll have two open worksheets (not within same Excel worksheet I already have open). This allows me to grab and pull one worksheet in a separate screen and leave the other as I need both open on two monitors.
Question: is there a way to default Excel when opening or double clicking an Excel file to automatically open in a separate instance of Excel and not in an existing open worksheet?
I am trying to launch windows explorer from within excel vba. The routine below is borrowed from another post on this site and modified for my purposes.
I have a macro to sort a very large list of materials by a variety of conditions.
The macro runs automatically when a cell on the master list spread sheet is selected and using If/ElseIf it sorts based on what cell they have selected.
Example If ActiveCell = "ALUMINIZED" Then ActiveSheet.Range("$A$14:$K$1945").AutoFilter Field:=2 ActiveSheet.Range("$A$14:$K$1945").AutoFilter Field:=4 ActiveSheet.Range("$A$14:$K$1945").AutoFilter Field:=1, Criteria1:= _"Aluminized"
Which is working perfectly. The problem I am having is that some of the cells are two lines so it looks like this:
BE BEARINGS
I don't know how to get it to launch based on that cell content because of the line break in there. Can I make it launch based on the first two characters only?
I have this code that looks through my worksheet once the conditions are met it will email, and in column "M" I put a hyperlink to where the document is stored. All works as far as the email format, even grabs the hyperlink but it’s not clickable in the email.
Here is the code.
I am outlook 07 and vista 07.
Option Explicit Const Startingrow = 11 'Data starts on row ## Const AlarmDelay = 183 'send warning Sub CheckTimeLeftFac() 'References needed : 'Microsoft Outlook Object Library
Dim i As Long Dim j As Long Dim msg As Long Dim Lastrow As Long Dim WhoTo As String Dim SubjectLine As String Dim MessageBody As String Dim olMail As Outlook.MailItem Dim olApp As Outlook.Application Dim strLink As String
I have hyperlinks betwene one worksheet to another - they only only hyperlinked thourh column & rows (eg: A100) etc. How can I lock these hyperlinks but still allow users to insert new rows without losing their place?
I am having a slight problem copying hyperlinks. I have written some code that sorts data by date and then creates a simple diary. It originally placed the name of the event in the new diary sheet. What I would like to do is instead of copying the name into this new sheet copy a hyperlink that I have created to the company's website for that event.
I can create the hyperlink using hyperlink(B1,A1) where A1 is the company name and B1 is the web address but since the new sheet will not have the underlying data I need to actually copy the values and format of the hyperlink rather than the formula.
I have some code that expects the user to select a file to open. If they don't select a file it posts an error message "Stopping because you didn't select a file" then it exits. However then Excel pops a debug window. How can I get it to cleanly exit and not pop the debug window?
I entered an activex object command thing.. and now I'm not sure how to exit out of it.. it just keeps alerting errors messages like reference is not valid and other ones depending on what I type in the formula box.
I just want to remove the object, but I can't get past the error alerts.. they just keep coming every single time I click somewhere on the workbook trying to exit out of it.. so I'm not sure how to even get out of it.. I don't want to open up Task Manager to exit out of the entire program because I didn't save my workbook.
I have the code below assigned to a commandbutton. I also have 4 or so other private sub macros on this worksheet. When the activecell is in range 2 and I push the button, it exits the sub routine like it's supposed to. But then it deactivates all the other macros and they won't work again until I close the workbook. How can I get this code to exit the macro if the first if statement is true and to not affect any other macros?
I have an input box which has OK and cancel buttons If the user clicks cancel I would like to routine to end, which I can do with exit sub. However this particular sub routine has been called from another so the rest of the code continues. Is there a way of exiting all the routines on cancel -- or a neater way than exit sub ?
I'm using a multipage control on a form that has the style set to fmTabStyleButtons. So it uses buttons instead of tabs. I named one of my buttons (tabs) to Close. Can I set this up to where just pressing the Close button will cause it to exit the app not just go to that page?
I have two userform combo boxes, the second follows up on the results of the first.
The second Combo Box looks for incomplete fields and provides them in a drop box. If the data the second Combo Box is looking at (This is different data than the first Combo Box is looking at.) is complete it updates the field, if not then it adds it to the drop down list.
My problem is this, if it finds everything updated and nothing is added to the drop-down list, how do I exit? I just want a complete break where all programming ends.
I am in the Initialize subroutine and I have tried Exit Sub and it still brings up the user form.