Pausing And Referencing In VBA

Oct 7, 2008

I have made 2 macros that run one after the other to perform a certan task. My issue is that I want to run Variants that I have defined in Macro1 In Macro2 but I dont know how to reference them macro 2, or if there in the same module do they recognize the varients anyway??.

I'll list the variants defined below; could someone provide me with the proper code to reference the variants form macro1 in macro2. I am also wondering if it would be easier to combine both macros under one macro and simply put a pause in the macro between both section and have a certain command to resume once the user decides to( so it would have to be a user command such as a button). If you think this would be easier could you please provide the code to pause the macro until A button is hit. both these methods woud be useful to me elsewhere as well so if it's not to much to ask could you provide both methods.

View 2 Replies


ADVERTISEMENT

Pausing Before Macro

Jul 7, 2009

1) open at a specific time each day,
2) grabs some information from Bloomberg (updating takes about 15-20 seconds after opening the workbook)
3) and then run a macro after the updating is finished.

Right now I've:

1) created a batch file to open the file
2) set Windows Scheduled Tasks to run that batch file at 4:15pm
3) Created a workbook open event that calls my macro if the workbook is opened between 4:14pm and 4:17pm

What I'm looking for is the best way to pause before running my macro until the workbook has been open for say 30 seconds. I have read through a lot of threads asking this question, but the threads have not been marked solved, and it seems that a lot of the proposed solutions have the problem of pausing all activity in the sheet, so the information from Bloomberg doesn't update while the macro is paused.

View 5 Replies View Related

Excel VBA Pausing For Bloomberg?

Apr 30, 2014

Trying to create a macro where it will begin by inserting today's date into a cell, then pause for roughly 35 seconds while the massive correlation matrix pulls all the correlations of the portfolio in, then takes an output value that is generated in the workbook from the filled correlation matrix (correlation coefficient) and copy's and pastes it in a different cell. Then it repeats this process again using "Today's date - 1" (yesterday's date), waiting 35 seconds again and taking the new output value and copy and pasting it below the previous one.

I know I am not close but here is what I have for code thus far (which does not work properly).

[Code].....

View 4 Replies View Related

Pausing Within For Loops Until Shell Command Is Complete

Nov 3, 2009

I have written a For loop that uses a shell command to call a batch file that replaces text in some text file, Mytrail.txt. I then use that altered text file and use it to run a 3D modeling program Pro/Engineer by calling it through another shell command. I would like to add pause instructions to my routine after the shell commands. Below is a snippet of the code I am working with:

For i = 1 To N Step 1
Shell ("Reblacer.bat Mytrail.txt string_A string_B)

'Here I would like to add code that will pause the routine until the batch file 'operation is complete.

Shell "C:Program FilesproeWildfire 3.0inproe.exe Mytrail.txt", vbNormalFocus

'Here I would like to add another pause instruction until the above shell 'command is complete. Note that this shell command creates a new file in 'some directory whose name is actually string_A.prt. Could this be used to 'tell visual basic that it may recontinue executing the routine.

Next i
End Sub

How to add pauses to the routine above that prompt visual basic to continue executing the code only after the shell commands have completed their tasks?

View 2 Replies View Related

VBA Referencing 2

Oct 1, 2008

I was wondering if using INDIRECT() function, or something like it in VBA, I could set a range as a reference instead of a fixed value... example below: Instead of the range being fixed on the first line,

View 4 Replies View Related

Referencing

May 30, 2007

I have a drop down menu where the user can chose between a,b,c and d. I would like to use this further in a formula. The formula is defined by me, although I dont think its relavant.

Lets say the drop down appears in B2, and I have got a formula called
Test1(B2). However this retunrs me an error. The contents of B2 is in string format.

- Test1(B2) does not work
- Test1(a) does work (assuming a is what B2 shows)

I would like to know how I can reference B2 as an argument in Formula, so it does not show error.

View 9 Replies View Related

List Referencing

Oct 21, 2008

I have 2 columns of info. 1 is a complete list. The other has many of the same values, but is missing a lot of the values in column one. I am marrying the two lists to see where the data gaps are. Both lists are from different databases and I need to know which data the second DB is missing. Currently I am lining the 2 columns up and doing it manually. Is there a way to do this quickly as there is about 1000 records.

View 2 Replies View Related

Referencing A Sheet Name?

Dec 2, 2008

looking for a formula that will get me the sheet name.example: I have 3 sheets each named X, Y, Z. in cells A1 I want the name of sheet 3, which would be X

View 2 Replies View Related

Referencing Every Nth Row From Another Worksheet

Dec 19, 2008

I need to create a worksheet whose sole purpose is to return the values from every 17th row from another worksheet in the same workbook.

I have spent a few hours trying to research the correct answer and OFFSET comes close but either I'm doing it wrong or it's not what I need.

I want to be able to drag the (every 17th row from sheet 1) formula down about 100 rows.

Assume A1 as starting place. I would prefer a formula answer as opposed to a macro or VBA.

View 13 Replies View Related

Referencing From Different Workbook

Jan 22, 2009

I have a workbook (Workbook A) which I need to lookup ( Vlookup() )something in a different workbook (Workbook B). In workbook A I need to lookup many (I mean hundreds) of values.

My question is: What do i put in the function tab (where we put the formulas and references) to lookup values in different workbooks? And if possible, is there a way to define a workbook A to ALWAYS look up values in a defined workbook B.

View 3 Replies View Related

Referencing The Name Of A Worksheet

Jun 24, 2009

way to reference the name of a worksheet in a cell, or even better, use a cell reference to dictate the name of a worksheet.

In other words, I would like to create a new sheet, and set it's name ='Sheet1'!C1 so that if I changed C1, the worksheet would automatically be renamed to whatever is typed in C1.

If that is not possible, I would like to have a cell be tied to the name of a given worksheet, so that if I renamed the worksheet, the cell would change accordingly...similar to the &[Tab] function used in headers/footers.

View 13 Replies View Related

Referencing Another Worksheet

Dec 23, 2009

I have an XLS spreadsheet which updates cells through an ODBC connection to a database. The information is pulled across ok and 90% of the Vlookup and IF statements work. The problem arises on a summary page.

When i start off the summary page has cell references in numeric order to another spreadsheet and pulls back the information to 4 cells Across and 1000 Down. ='Campaign Responses - Cash Break'!A2

This is a spreadsheet that changes once the queries have run and a number between 1-1000 records are returned. However once the data has changed and the page refreshed. Not all the results have been pulled across to the summary pages. A few are there but the numeric sequence jumps from......

View 2 Replies View Related

Referencing One List From Another

Oct 23, 2013

I have several options in one list, call it MASTER.

When I pick Item A from the MASTER, I want to show all available options for that Item A in another list, called OPTIONS.
I have 10 Items, and they all have a variation of 6 different options, some Items have 1 option, some have all 6.

Anyway, the worksheet I found is attached, but cannot figure out how this is working.

View 14 Replies View Related

Using For Loops When Referencing

Aug 20, 2009

First of all, I'm completely new to both this forum and VBA. I have just done a programming course in java before. I hope you will forgive me if this have already been posted. No to my problem.

I am tryring to use different projected values to project other subparts of those units, which is done in the sheet mean needed weekly. Tje values are taken from projections. The answer that I get from mean needed weekly should be copied to a third sheet.

This is the code that I am using right know, but I cant get the for loop to work (or more exactly to be able to place the "i" in my text without making compilation errors).

View 9 Replies View Related

Dynamic Referencing

Dec 1, 2009

I have a worksheet titled "Systems Estimate" that will dictate values on a second worksheet called "CSI Estimate". They're the same values in each cell and column, just in a different order row wise. I would like the values in each row in the A column in the "CSI Estimate" sheet to dictate columns B through W, with the values being referenced from the "Systems Estimate" sheet. I tried using an exact match with vlookup since the data isn't sorted, however it just returns the formula I enter, not a value.

View 3 Replies View Related

Relative Referencing In VBA

Dec 3, 2009

Relative referencing in VBA. I have this formula in one of my modules:

View 4 Replies View Related

Date Referencing

Jun 26, 2006

I have a cell that mentions the year (G7) and the sheet mentions the pay period beginning (ex: January 1).

I would like to have a different cell (B9) combine the two into a date that other cells would recognize as such.

For instance, if the sheet name is January 1st and cell G7 has "2006" as a value, then I would like B9 to read "1/16" (year not shown). From there another cell (A13) would show that day/date as "Sunday, January 01, 2006".

View 11 Replies View Related

Referencing A Cell By Tab Name

Feb 8, 2012

Here is a formula I am trying to use to access another woorksheet to compare the values in J13 in each worksheet.

=IF(J13=INDIRECT("'"&$O$4&"'!"&"J13"),"▬",(IF(INDIRECT("'"&$O$4&"'!"&"J13")=" ","▬",(IF(J13=" ","▬",(IF(J13>INDIRECT("'"&$O$4&"'!"&"J13"),"▼","▲")))))))

Where O4 contains the name of the first worksheet.

I want the formula reference [J13] to chage to J14, J15 and so on.

View 3 Replies View Related

Referencing One Cell From Another

Nov 30, 2006

I'm dealing with a DDE link and have a cell that works when I type in the value =WINROS|AVEVOL!XOM . But I don't want to manually enter each value. So I have tried to use =INDIRECT("WINROS|AVEVOL!" & A2) where A2 contains the value 'XOM', but I get a #REF! error.

View 9 Replies View Related

Referencing Between Worksheets

Dec 29, 2006

here's a simple discription of what I would like to do:

I have two worksheets open, SHEET1 and SHEET2

In SHEET1 I have numbers 1,2,3...10 running in cells A1.....A10

What I would like to do is add up a certain range of rows in
SHEET1 from target values I place in SHEET2

example:
in SHEET 2:
A1 = 3 ( I insert begining row )
A2 = 5 ( I insert last row )
A3 = equation to add up rows 3 to 5 in SHEET1, ie: A3+A4+A5

What is the equation I should put in A3? This driving me nuts!!

View 9 Replies View Related

Vba Sheet Referencing

Apr 12, 2007

I have 8 sheets, named cpt1 to cpt8 in vba.

Now i need to loop through these 8 sheets, storing the same range of each sheet into a matrix. I have the following

dim test () as variant

For i = 1 to 8
(1) test = sheets(i).Range("b2:u21")
(2) test = cpt1.Range("b2:u21")
next i

Now (1) doesn't work, but (2) does. However i do not know how to reference the cpt1 sheet name using the for loop (ie "cpt" & i) Can anyone help me with getting this to work?

View 9 Replies View Related

Math Using (J, I) Referencing

Aug 20, 2007

I am trying to create a macro that will do some basic math using J, I as referencing.

Sub Table()

Dim Temp
J = 2
I = 1

For Temp = 1 To Question
Cells(J + 35, I).Formula = (Cells(J, I + 2) + Cells(J, I + 2) * Cells(J, I + 3) - Cells(J, I + 4))
J = J + 1
Next
End Sub

how do I get the math to work without the R1C1 referencing?

View 9 Replies View Related

Referencing Workbooks ..

Jul 20, 2008

I have this excellent code which I found on here that looks at the data in column A, looks at the data in column B & then returns the differences ie.

A_____________B_________C___________D______________E
John________Jimi_________________Not in A_______Not in B
Paul________Sporty________________Jimi____________John
George______Ginger________________Eric____________Posh
Ringo_______Scary_________________T-Bone__________Baby
Posh________Eric
Scary_______Ringo
Sporty______Paul
Ginger______George
Baby________T-Bone

Here is the code ....

View 9 Replies View Related

Vertical Referencing

Dec 22, 2009

Trying to build a form that helps assemble parts a pieces based on filling out just a small section of information. Here just a short example:

Tower Type: Type 1
Coax Length: 100 ft

Based on the above criteria, I am going to have a line item that auto fills specific parts and pieces based on the answer. The main problem I have is the coax length answer will fit within several ranges and I need a cell to be able to identify and autofill ALL of those ranges.

Specifically, if the coax length is between 0 and 100, I need to autofill the below cell with Coax 1, from 101 to 200 Coax 2, and so on and so forth. Lets say I have 5 ranges of "greater than, less than" values. how do I make a formula that will consider all of these in a VLOOKUP scenario?

If I haven't asked the right questions, or phrased them incorrectly, please let me know....I'm not the most excel experienced person...hence my visit to this forum!

View 9 Replies View Related

Referencing Arrays

Jun 15, 2006

I'm trying to do a loop through four arrays named Asc, Bsc, Csc and Dsc. I'm using the following code to do this but it comes up with a Type Mismatch error on the penultimate line. Please could someone explain the problem? I'm getting a bit confused as to whether I'm mixing up different types of variables, and not sure if CVar is the appropriate function.

For ch = 65 To 68
Sc = CVar(Chr(ch) & "sc")
For r = 1 To 3
If Sc(r, 1) = "" Then 'ERROR HERE
etc...

View 9 Replies View Related

Referencing Across Worksheets

Jun 20, 2006

in sheet1 i have a list of names in column B. in the next columns(C to H) i have some numerical data about them. in sheet2 i want to keep only the names and the data in column H. all works fine except... if i insert another line in sheet1 the data in that line is not inserted in sheet2. and if i remove a line in sheet1 i get a ref error in sheet2. what can i do so the new data is inserted correctly?

View 4 Replies View Related

Referencing Protected Add-in

Sep 28, 2006

What I'm tring to do is to reference a protected addin from an Excel workbook. The issue is that I do not want the user to be prompted for the password. Is there a way to programmatically input the password for the referenced add-in so that the user does not have to?

ThisWorkbook.VBProject.References.AddFromFile _
"\chapgfs3DCRDCR Add-inDCR 1.11.xla"

View 3 Replies View Related

Cross-referencing Two Spreadsheets

Jun 20, 2014

Basically I order thrice a week from a certain supplier to fill the shelves of my shop.

They make available to me two spreadsheet dumps: an orders spreadsheet, with the following columns:-

order ref
date
unique product code
description
qty

9262
03/07/2013
622642
Fabric Dye
4

And an invoices spreadsheet with the following columns:-

invoice ref
date
unique product code
description
qty

122551
04/07/2013
622642
Fabric Dye
4

Basically I can see the potential here to find out what we've ordered but that which they haven't sent which would be so handy.

I have tried to vlookup() produce code against product code, this kind of works but below are some example drawbacks:-

1) no idea if I've ordered it ten times and they've only not sent it once, or if I've ordered it ten times and they've not sent it nine times.
2) no idea of dates - i.e. ordered this in June '13, October '13 and February '14 and they sent it in February '14 only.

View 5 Replies View Related

Referencing Table On Another Sheet

Jun 26, 2014

I have a spreadsheet with two sheets in it.

Sheet 1 = sheet with formulas/functions for data analysis
Sheet 2 = sheet with table

I am trying to reference a column in the table on sheet 2 from sheet 1. Specifically, I am trying to set up Data Validation that will create a list of unique values from a column in the table. I tried:

[Code] ......

There is a space in the header name of the column. but I was unable to get the validation to work even with columns that have just a single word name.

I also tried:

[Code] .....

and that did not work either.

View 3 Replies View Related

Dynamic Table Referencing?

Mar 16, 2014

I am trying to pull data from different Tables within a workbook by typing the name of the referenced Table in a cell rather than leaving it static withing a VLookup formula.

So far I have this:
=VLOOKUP($B6,OctTable,MATCH(D$4,$D$4:$V$4,0),0)

What would I do if I wanted to be able to dynamically change the "OctTable" portion with the name of another table which I type in call A6? I have researched as best possible and think that it might have something to do with INDEX, but I have failed to figure it out.

View 1 Replies View Related







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