Invoke Running A Macro From Within An "IF" Function.

Feb 7, 2006

I want to Hide a range of rows (16:18 in this example) if "no" is in a range
of cells and Unhide the same range of rows if "yes" is in the same range of
cells. The "Hide", "Unhide" macros (below) work if I select one from the Run
Macro list, of course. But, how can I call for it to run from an "IF"
function. I know this statement is wrong, but it may help you know what I am
looking for: =IF (A1:A15="no",Run Hide,IF (A1:A15="yes",Run Unhide),"")

Sub Hide()

Rows("16:18").Select
Selection.EntireRow.Hidden = True
End Sub
___________________
Sub Unhide()
Rows("16:18").Select
Selection.EntireRow.Hidden = False
End Sub

View 11 Replies


ADVERTISEMENT

Hyperlink To Invoke An Autofilter VBA

Aug 15, 2006

Is it possible to create a hyperlink for a cell to display a textbox that enables the user to input a specific cell value that will autofilter a worksheet to pull up only the rows that is related to that value?

View 5 Replies View Related

Invoke Unix Script With VBA

Nov 28, 2006

Is it possible that i can execute a Unix C-shell script named "get_summary" and after executing it, it will generate a file named xxx.asc ?

I have added on a statement :
A.writeline "get_summary" 'To execute a script

but i can;t seem to get the csh script to run. Pls help. Thanks again in advance

Dim userinput As Variant

userinput = "xxx.asc"

Set fs = CreateObject("Scripting.FileSystemObject")
Set A = fs.CreateTextFile("c:script.txt", True)
A.writeline "open 10.10.10.10"
A.writeline "xxx" 'username
A.writeline "xxxxxx" 'password
A.writeline "cd /export/home/tae/scripts" 'directory on FTP site
A.writeline "get_summary" 'To execute a script
A.writeline "ascii"
A.writeline "get " & userinput 'file to be uploaded
A.writeline "quit"
A.Close

View 5 Replies View Related

Invoke A VB User Form Through A Cell Value

Mar 19, 2009

I have created a VB User form in Excel. I have a value in Cell A1. On clicking the cell, the user form has to be invoked. I do not find a way to do this using HYPERLINK function. If I use a label in that cell, I am able to implement it. But I may want to sort the excel cells and in that case the label idea will not work out!!!!

View 3 Replies View Related

Invoke 2nd Procedure In Master Worksheet

Feb 7, 2013

I have a code that looks fetches all names of the worksheets in a workbook and lists in a master sheet.

[Code

Sub Button1_Click()
Dim ws As Worksheet
Dim x As Integer
Dim lr As Long
x = 2
lr = Worksheets("Totaliser").Range("A1").End(xlDown).Row
Worksheets("Totaliser").Range("A2:A" & lr).Clear

[code].....

This works fine collecting all of the named sheets but is there a way of me invoking a 2nd procedure to count the number of rows within each worksheet that contain line items which are updated at the beginning of each month. Placing them into the next column (B) to the right of the sheet names.

All worksheets contain a header Row (1) so the count function would if at all possible count from the 2nd Row to the end.

I have tried different lines of code but just get errors.

The code above places the first sheet into cell A2 and then down respectively

View 2 Replies View Related

Invoke Page And Click On Submit Button

Nov 23, 2013

I am new to excel macro. Want to invoke a page and click on submit button. Getting "Object doesnt support this property or method" error on the line "Subm.Click"

My code is,
Sub Macro1()

Dim IE As Object
Dim URL As String
Dim Subm As Object

URL = Range("B3")

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

View 1 Replies View Related

How To Stop Function Running

Oct 16, 2008

Hi, I am runnning this marquee label function in a userform (Dash). When I close the form, using 'unload frmDash' the function is still running in the background. Can someone give me a tip on how to end it at the same time as the form is closed?

View 14 Replies View Related

Embedding Script That Will Automatically Invoke Putty Program And SSH To Network Devices

Oct 4, 2013

I have a spreadsheet of device names and IP addresses. I want to be able to click on an IP address and have it automatically invoke A SSH program ( putty.exe ) to automatically login to the device.

View 1 Replies View Related

VBA - Temporarily Stop Function While Sub Is Running

Jan 18, 2013

I have a vba function linked to conditional formatting that i want to temporarily stop while a sub to insert a line is running as the sub stops when it hits the sheet where the vba function operates. When i disable the vba function (or remove the vba function) the sub works fine, if the vba function is not disabled the sub stops.

View 4 Replies View Related

Running Average Formula/Function

Aug 22, 2006

I wonder if it is possible to formulate a formula in which average values are recalculated after every added record.

For example:
Record 1 shows an amount of 200 so the average value after 1 record is (200/1) 200. Record 2 shows an amount of 250 so the average value after 2 records is ((200+250)/2) 225. Record 3 shows an amount of 210 so the average value after 3 records is ((200+250+210)/3) 220.

I don't want to calculate all averages manually and most probably there must be a formula that is able to recalculate the average value after another record is added to the file.

View 6 Replies View Related

Prevent Custom Function Running When Inserting/Adding Rows

Apr 8, 2008

I have a piece of code that hides unneeded rows, it does work but it is very slow.
This is in the worksheet part of the project. My problem is as it runs it "jumps" in to a function I have in a module that counts continuous rows. I would like to know why it is doing this and what I need to do to stop it? I have another piece of code that is structered exactly the same that hides unneeded columns and I do not have any problems with that. I know both pieces of code are dealing with rows and I think this is part of the problem but I can not see any reason why the first bit would call the second bit?

Dim C
With Worksheets("CEN OAS"). Range("D5:D378")
.EntireRow.Hidden = False
End With
For Each C In Worksheets("CEN OAS").Range("D5:D378")
If C.Value = "" Then
C.EntireRow.Hidden = True
End If
Next C

Function to count used rows....................

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

Running Macro In Another Workbook

Sep 17, 2009

I have 2 files in a folder, "Main.xls" and "My Database.xls". "My Database.xls" contains the following macro in 'Module1':

View 2 Replies View Related

Running Macro From A Cell

Jul 23, 2014

I am trying to utilise a vba script for DNS resolution which i got from Followup: DNS Lookup and Ping in Excel - CodeProject

I have a list of IP addresses that I want to use this on, however if I test this by using the test instructions, excel does nothing, its just text in a cell, so I would like to know how would this procedure get called from the spreadsheet?

Code:

GetHostname("4.2.2.1") in any Excel cell.

or

Use: GetIpAddress("www.google.com") in any Excel cell.

View 3 Replies View Related

RUNNING AUTOMATIC MACRO

Jan 12, 2007

I am trying to achieve an automated macro.

I would like my spreasheet to look at cell B2, compare this to a list of information in Sheet2 and if it matches, run Macro1

View 9 Replies View Related

Running Macro On Close

Jun 19, 2008

I'm trying to run what is a pretty basic macro when a file is closed

Sub Auto_Close()

FileCopy "C:Documents and SettingsdaveDesktopWorking olderPlanner.xls", "S:LeavePlanner.xls"

End Sub

I've checked that the Auto_Close feature is what I need, but it just doesn't seem to be running

I've tried it from clicking the x, and also File>Close, but with the same lack of success

View 9 Replies View Related







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