Entry Based Execution Of Macro
Dec 19, 2008
I have to make eighty to ninety entries daily in Column B. Then transfer these entries to another column N,(by copy/paste) after that a maco "text to column" is executed. Now I have linked Column B to N like =B2, =B3, etc. etc. thus instead of copy/paste, the data when entered in Column B, is automatically going to Column N. I wish that the macro (text to entry) may be executed by each entry made in Column B. Is it possible with a macro?
View 7 Replies
ADVERTISEMENT
Jun 1, 2007
I have this codes which will only trigger if I manually execute it. What do I need to do to trigger it automatically whenever the worksheet change.
Below is the codes:
Sub Risk_Color()
Dim c As Range, myFontCol As Integer, myCol As Integer
For Each c In ActiveSheet.Range("f7:g20000")
myFontCol = xlAutomatic
myCol = xlNone
Select Case c.Value
Case Is = 1, 2, 3
myCol = 34
Case Is = 4, 5, 10, 20: myCol = 43
Case Is = 30, 40, 50: myCol = 6
Case Is = 70, 100, 140, 150
myCol = 5
myFontCol = 2
View 9 Replies
View Related
Mar 7, 2013
I am trying to fix a problem that I am having with Bloomberg add-in for Excel. Each day I populate 31 days of historical price data for 500+ stocks.
$A$K3 = "ACE US EQUITY"
$AL$3 = "=BDH(AK3,"PX_LAST",$D$1,$C$1,"DTS=h","dir=h")"
$C$1 = "=WORKDAY(TODAY(),0)"
$D$1 = "=BAddPeriods(C1,"NumberOfPeriods=-31","Per=wd","CDR=#A")"
What is supposed to happen is that in $AL$3:$BQ$3 there will be prices for 31 days.
I leave the workbook open as the Bloomberg DDE session remains open for 3 days even if the Bloomberg executable is not running.
Sometimes there is no problem and when I come into work the following day, the data is shifted forward by one day. Other times, much of the data is missing and I am forced to select and refresh each $AL$_ field. The problem with this is that for some reason the refresh is happening synchronously and I think this is causing havoc on the DDE connection and/or Excel. Resulting in slow/no updates. Also, if I refresh the worksheet some formulas will be overwritten with static data!
What I would like to do is create a macro that will:
1) clear all data in $AL$_:$BQ_$ & $BS$_:$CX_$
2) set the value of $AL$_ = "=BDH(AK$_,"PX_LAST",$D$1,$C$1,"DTS=h","dir=h")"
3) wait until the data is populated into $AL$_:$BQ$_ before going to $AL$(+1):$BQ$(+1); if $AM$_ has a value then most likely the data has populated in that row.
4) then when $AL$_:$BQ$_ is finished, do the same for $BS$_:$CX$_
I have been waiting for Bloomberg support to fulfill this request for over one month now with no results.
I have a very minute amount of code below:
PHP Code:
Sub PopulateData() PopulateData Macro Range("AL2:BQ2").Select
Selection.ClearContentsRange("AL2").SelectActiveCell.FormulaR1C1 = _ "=BDH(RC[-1],
""PX_LAST"",R1C4,R1C3,""DTS=h"",""dir=h"")"Range("AL2").SelectEnd Sub
View 9 Replies
View Related
Mar 12, 2009
I have a problem with the following code
Dim strProcLine As String
With ActiveWorkbook.VBProject.VBComponents(ActiveChart.CodeName).CodeModule
' MsgBox ok
' adaugat procedura goala
.CreateEventProc "Calculate", "Chart"
'MsgBox ok
strProcLine = "Format_Chart"
' MsgBox ok
.InsertLines .ProcBodyLine("Chart_Calculate", 0) + 1, strProcLine
' MsgBox ok
End With
' MsgBox ok
This is part of a larger macro, wich makes 2 pivottables and for each PT a chart, and for each chart i create an even procedure (Chart_Activate) wich calls a procedure to format the chart. Tha macro is alocated to the click even on a button in the sheet where i get the information from.
If i run the macro(click the button) with Microsoft Visual Basic Editor opened all goes ok. But if i close Microsoft Visual Basic Editor and then run the macro it stops right before .CreateEventProc "Calculate", "Chart" of the first chart , and i can't understand why. No error mesages delivered, nothing.
View 9 Replies
View Related
Jul 11, 2006
I have written a macro .When i execute the macro the result is displayed but my excel file hangs after that.
View 3 Replies
View Related
Jul 3, 2014
I have macros that often pause for the user to take some action -- for instance, to confirm that the correct cells are selected, or to delete something. Usually I use the "Stop" command, which opens the VBA editor; when I finish doing the manual action, I just resume the macro.
When writing macros for actual users, I'd like to do the same thing without their having to deal with the VBA window. Is there a way to pause and resume action and remain in the Excel window?
View 3 Replies
View Related
Dec 18, 2012
I have a macro where I am assigning a variable and the value of the variable is a path where the data is stored. i am trying to assign a shortcut key for macro, i tried to run the macro by going to the vba mode and then click on the F5 function key and the macro run absolutely fine. but when i use the shortcut key the file just opens and just exits the macro.
Code:
Option ExplicitDim a, b, c As Long
Dim myFolder As String
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim sql As Variant
Sub Macro1()
Application.DisplayAlerts = False
[Code] ....
View 4 Replies
View Related
Jun 7, 2013
On a worksheet I have a command button that displays a ConfigureCatalog form.
Code:
Public StopRequested as Boolean
'Worksheet Command Button will display the Configure Catalog Form
Private Sub CmdConfigure_Click()
CatalogConfigForm.Show vbModeless
End Sub
The ConfigureCatalog userform has two Command Buttons: cmdRebuildCatalog, and cmdStop. RebuildDSWCatalog is a macro that reads and analyzes just over 35,000 records and updates other worksheets. As it runs, it repaints the CatalogConfigForm with a progress message every 100 records. It can run for about 3 minutes. I want to provide a "STOP" button that will allow the user to interrupt the RebuildDSWCatalog macro and return control to the user.
Code:
Private Sub cmdRebuildCatalog_Click()
StopRequested = False
Call RebuildDSWCatalog
End Sub
Private Sub cmdStop_Click()
StopRequested = True
End Sub
While processing the 35,000 records, I want the RebuildDSWCatalog macro to check whether StopRequested has been set to TRUE prior to processing the record. If StopRequested = TRUE, I want to drop out of the macro.
Code:
Public Sub RebuildDSWCatalog()
StopRequested = FALSE
For DSWRecord = DSWStart To DSWCount
If StopRequested = True Then
[Code] ....
Problem is that once the RebuildDSWCatalog macro starts running, the STOP command button never seems to get the focus back. All other input is inhibited until the macro ends.
It just ignores that I'm hitting that STOP button. In fact, the button doesn't visibly respond at all until RebuildDSWCatalog finishes processing all 35,000 records.
View 4 Replies
View Related
Jan 18, 2007
What code do I use so that if an error is encountered during the execution of a macro, the macro ends, rather than an error message popping up?
View 9 Replies
View Related
Dec 4, 2011
I have a row of dates in row 2 (all sequential, from Nov through to June next year)
I have a row of number entries in row 3 (to correspond with the date in row 2 it was entered on).
I want to be able to add a new entry (a number) into a text box, click a macro button, which makes the text box input be moved into the cell underneath todays date (so every day the cell will move one column along)
I've managed to make myself a textbox, and a macro button, but I'm stuck with how to make it all work.
View 5 Replies
View Related
Jun 9, 2009
Now..when I run any of my macros, I get the following message.. "Code Execution has been interrupted".
I'm not sure why I'm getting this message but it happens everytime I run ANY macro. Note that if I hit "Continue" every time it gives me the option, I am able to successfully run the macro, but obviously, I shouldn't have to do this.
View 5 Replies
View Related
Jul 15, 2009
I just finished a great macro and right at the end of deleting a sheet, I got a message box saying
"Data may exist in the sheet(s) selected for deletion. To permanently delete the data, press Delete"
How can I eliminate this from popping up in the middle of code?
View 2 Replies
View Related
Mar 20, 2014
I have a percentage in R3.
If I make an entry in D13 then I want the R3 to be duplicated into C27 otherwise C27 should be 0.
View 4 Replies
View Related
Jun 25, 2009
making a macro that will scan for duplicates, length & empty cells.
I have the sample file below that does conditional formatting but it doesnt help as much because I want to show the reason for the highlight's on a comment instead.
sample file : [url]
file that might help out: [url]
checks would be:
column A - duplicates and/or length should not be over 100 characters
column B - duplicates
column F - should only contain 2 comma's(or 3 keywords)
all columns - check if no entries are found(empty cells)
View 9 Replies
View Related
Jul 25, 2013
I have a procedure that allows me to view and make changes to data in a table. I list the current values for the item in one column and use simple formula to copy that value to another column where if there are changes that need to be made, the formula is simply overwritten. The Macro is then selected using a command button and the formulas are all overwritten using copy/paste values to keep from writing out the formula to the data table. These values are then all written back to the data table, current values are overwritten with whatever is in the update column, new data or old data.
I have one cell out of 48 that has decided to march to the tune of a different drummer. The format changes from General to Text and the formula written from the macro is what shows up in the cell instead of the value of the formula. Never a big disciplinarian, I have to wonder if I have been too lenient on the cell and this defiance is the price I have to pay.
The sheet is protected only allowing entry into the cells available for update.
Here is the bit of code that affects this cell (starting from a format of General:
Code:
Sheets("Product Data").Cells(ItemRow, 3).Value = Sheets("Update").Cells(6, 8)
Sheets("Update").Cells(6, 8).FormulaR1C1 = "=(RC[-6])"
I just don't see anything that would change the format, and these are the only two lines that even reference cells(6,8).
I tried to set the format for the cell from within the Macro, but with the sheet being protected, it just dumps me out to my error message.
View 1 Replies
View Related
Sep 7, 2006
I am looking for a way to measure how long it takes to complete a sub routine in VBA. I have code which posts data to matlab and then calls it back. What I need to know is how long does it take to complete each subroutine.
create a code which will measure this? I need to measure the time taken in 100ths of a second.
Is there any simple code to complete this? I am pasting a sample of my code which is using Matlab as a COM server.
Dim Matlab As Object
Dim MReal(10, 0) As Double
Dim i As Integer
Dim j As Integer
Dim MImag() As Double
Dim value As Double
Dim RealValue As Double
I am sure I woould need to declare the timer but I do not know where and I am not sure of the syntax.
View 9 Replies
View Related
Jun 7, 2007
is it possible to show progress indicator if macro execution take some considerable time say more than 10 seconds?
View 2 Replies
View Related
May 1, 2009
I used a form with textboxes for data input for one of my vb macros. Currently I have the private sub from the form transfer those entries to a remote cell on the spreadsheet, (like in column "HZ"), so that the macro that will actually utilize them can retrieve them. Is there a way to pass that data directly from what is entered in the form in the textboxes to the macro that will actually use them?
View 4 Replies
View Related
Oct 6, 2008
i have the following formula which counts various cells containing dates and i need to add in a count for 1 cell, BV21 but it needs to count 3 if theres a date and 0 if the cell is empty or reads NA
=COUNT(AS21:AX21,BH21:BN21,BR21:BU21,BW21:BZ21)+
(COUNT(AY21,BB21,BE21,BO21)>0)
+(COUNT(AZ21,BC21,BF21,BP21)>0)+(COUNT(BA21,BD21,BG21,BQ21)>0)
+IF(CB21>0,CB21,0)+IF(CD21>0,CD21,0)+IF(AP21="Y",2)[/size]
might be simple to some but it really has me stumped.
View 2 Replies
View Related
Aug 21, 2009
dont know if this can be done using a formula rather than VBA...but is there a formula that would change the countif range based on another cell entry. so the formula below has a column range of 2...so the other cell entry would be '2'.
=COUNTIF(B1:C1,"=Y"). If i then changed the cell entry to '4' the formula would change to. =COUNTIF(B1:E1,"=Y")
View 2 Replies
View Related
Dec 27, 2008
do Different SORT based on data entry.
I have a macro in a workbook that looks like this:
View 2 Replies
View Related
Dec 1, 2006
I will try putting the Code Tags in correct this time, I think I figured out what I have been doing wrong.
This code will allow one cell to make a sound when a condition is met. I am trying to have each cell stand on its own. Example cell A1 would sound a Ding if the number >100 and cell A2 would sound a Tada if the word Cat would be returned ....
View 9 Replies
View Related
Oct 2, 2008
So the title isn't really totally descriptive but it was all I could come up with. I have a work book that has 30 identical sets of 5 cells for users to enter in information. Some of my users will not need all 30 sets. I'm wondering if there is a way for the user to enter the number of cells they need and have excel then format so they have the desired number, instead of 30. Then have excel change all the instances of this number in formulas so that it matches the new number of cells. I hope I explained this well enough for someone to help.
View 9 Replies
View Related
Dec 17, 2008
i'm trying to basically use VBA, so that when a list of work tab names are entered into a column in say Sheet 1..these tabs are then selected.
View 4 Replies
View Related
Mar 26, 2009
I have a dilemma.
1.I want to be able to a have a cell be filled with a certain value when the user enter data in Column C.
2.I know that this can be accomplished by a formula, but my spreadsheet will work my efficiently with a macro.
3.I do not know much about VBA but I believe that I will need a macro for each sheet that fills in the word.
View 6 Replies
View Related
Mar 28, 2009
Is there a way of a user can add a number in a cell and this would hide a different amount of columns.
OR :
Ideally I would prefer a drop down with dates and the user could select a forward date and all the columns with dates up to that would appear. This would mean they could look as far our as required and all unwanted data would be hidden.
View 4 Replies
View Related
Oct 5, 2009
i'm sure this can be done but i cant get an angle on the method. i want to use VBA to put a formula into cell G3 based on the users entry in cell D3 so, for example the user enters M in cell D3 and the VBA code puts the formula "if D3="M",A3,0"into cell G3
i know i could use a formula in the cell but i want it to work with multiple entries so i figure VBA is the way to go.
View 9 Replies
View Related
Oct 12, 2009
I have a user form with some option buttons (1,5,10,etc...) that are used so the user can select a given number of cells they want selected. My last option button is labled Other(optOther) and has a textbox next to it(txtOther).
What I am trying to do is give the user the option to either select one of the given numbers or be able to enter their own number. The data will then be extracted from one worksheet to another. I have all the coding for the optiong buttons with the given numbers, just cant figure the textbox one out.
My data starts on B5, so what i am trying to do is when the user enters number n, i would need data from B5:B(n+4).
View 2 Replies
View Related
Oct 28, 2009
I would like to write the code or create a macro that will execute when the value of a range of cells is greater than null. The macro or code that I would like to execute will UNHIDE a group of consecutive rows.
View 14 Replies
View Related
Jul 12, 2012
I have a workbook with 3 worksheets which contains a single spreadsheet where the user enters data and 2 worksheets containing all the named ranges and formulas(divided up by product model) used on the data entry worksheet. What I've been trying to accomplish is to choose one worksheet based on which product model I select on the data sheet.
View 1 Replies
View Related