Macro That Executes Upon Open

Aug 18, 2009

I have the code below that puts in the file name, date and time and page numbers. That works fine, however, I changed the name of this macro to AutoOpen thinking that this would execute upon opening an Excel doc -- I think this works for Word, that's why I tried it. Anyway, it doesn't execute upon opening an Excel doc. Can anyone tell me how to get that going? Also, the font of the file name comes at at 12 point while the other entries come in at 6 pt - any way of making these all consistent, say 8 pt? Thanks for your help.

By the way, I'm a novice at Excel macros so being fundamental in your answer would be very helpful (i.e., don't know why there is a distinction between Regular Modules, Worksheet Modules and Workbook Modules. Seems to me I should always be creating Regular Module macaros so that they are accessible to all Excel docs but, again, I'm new at this so I'll have to read more about these items as well).

View 6 Replies


ADVERTISEMENT

Timer Running While Macro Executes

Jun 2, 2013

Is there a way to have a count up timer display in a cell while a macro is running, and then stop when the macro stops

View 5 Replies View Related

Excel 2007 :: VBA Macro Executes When Press ESC?

Jun 4, 2012

I have an excel workbook created in 2007, but now running in 2010. In the workbook I have a form Combo box with a macro assigned to it. When I click any value in the combo dropdown list the macro executes. In 2007 I could click the combo dropdown box and then press ESC to exit from the form control without executing the assigned macro. Similarly I could also click on any other cell to exit from the control without executing the macro.

But, in 2010 if I press ESC or click on any other cell the macro will execute. Sometimes I want to be able to exit from the combo box without executing the macro.

View 3 Replies View Related

Macro Code Executes Very Slowly: Filling Some Cells On Different Worksheets

Nov 9, 2006

I have the following code attached to a userform. It works perfectly (for what I need) although I know it may not be perfectly written. However it does seem to take for ever to execute considering it's just filling some cells on different worksheets. Have I missed something out or got it tied up doing something that takes a long time. If it's just a fact of life that it takes this time then I can live with it.

Private Sub UserForm_Activate()
Dim wsCB As Worksheet, wsLL As Worksheet, wsBond As Worksheet
Dim rngFound As Range
Set wsCB = Sheets("Current Bonds")
Set wsLL = Sheets("Landlords")
Set wsBond = Sheets("Bond")
TenancyStartTxt = Format(TenancyStartTxt, "dd-mmm-yy")
RnwlDteTx = Format(RnwlDteTx, "dd-mmm-yy")
Application. ScreenUpdating = False
10 MyBond = Application.InputBox("Bond number for renewal?", "Bond Number")
strFindMe = MyBond
With wsCB
Set rngData = .Range("c13:c490").......................

View 5 Replies View Related

Excel 2007 :: VBA Find Macro Executes But Copy / Paste Not Working

Mar 23, 2012

Excel 2007, Windows XP Pro

Dim strLoan As String
Dim longCat As Long
Dim rHere As Range
Range("A1").Select
[Code] .....

I can see the cursor move to all the desired cells when this macro executes; it just isn't dropping any data where it should be. I have been working at this stage for the last five hours with no success. I don't know whether my copy-paste methodology is broken or if it is my selection criteria

View 1 Replies View Related

Excel 2010 :: Automation Error When Click On Button That Executes Macro

Aug 22, 2012

I keep getting an automation error in excel 2010 when I click on the button that executes the macro. Excel crashes when the box appears. There is no code in the error box. Why I get this error message.

View 2 Replies View Related

MsgBox Does Not Appear After The Code Executes.

Jan 5, 2010

I have a code, which works, but I want msgbox appear after the code executes. But it does not.

View 5 Replies View Related

Macro -open The Look In List” And Stop So I Can Pick A File To Open

Oct 18, 2008

I want to create a macro that will “open the look in list” and stop so I can pick a file to open. I’ve tried to use “record a macro” and “ctrl-o”, but the record a macro won’t stop until I pick a file or cancel the file list. I also tried to use “o” in the short cut key box

View 5 Replies View Related

Does An Add-in Script Executes From A Remote Computer?

Dec 2, 2009

i have an excel file with some vba code that includes some functions of a third party add-in also. It works fine when i open this file on the host machine. (Assuming host machine is where the Excel File is placed) But when i try to open the same file from some other computer(remotely/by sharing folder), the add-in malfunctions because of one reason that it considers the remote machine to be its host. Is it possible to set a permanent host machine for that any add-in. Or is it possible for that add-in / Excel file to do its calculations and updation of links on the host machine where it is placed.

View 4 Replies View Related

Sort Code Only Executes When Debugging

Nov 15, 2006

Within the code I am asking excel to sort two difference worksheets with virtually the same code, except that one of the worksheets does not get sorted. If I step through the code, it works and the worksheet is sorted, but if I just run the macro the worksheet does not get sorted, as if the line of code in question is being skipped. Pointedly, my question is - Why does the code work while debugging (stepping through) but not when I generally run it?

Also, as far as the code is concerned, I am sure that the all variables contain the information I need them to and am also sure that any ranges created from those variables are also the ranges they should be. Here are the two lines of code that are supposed to sort. The UBOC cash sheet gets sorted, but the LNB cash sheet does not.

'Sort the UBOC cash sheet.
wsUBOC.Range("A5:G" & lUBOCRow).Sort Key1:=Range("A6"), Order1:=xlAscending, Key2:=Range("D6"), _
Order2:=xlAscending, Key3:=Range("G6"), Order3:=xlAscending, Header:=xlGuess, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom

'Sort the LNB cash sheet
wsLNB.Range("A1:G" & lLNBRow).Sort Key1:=Range("A2"), Order1:=xlAscending, Key2:=Range("C2"), _ .............

View 2 Replies View Related

Scrambled Charts After Code Executes

Jan 11, 2007

I have an excel based report consisting of several worksheets. Each worksheet contains VBA code which allows the user to generate custom reports with a series of Excel Charts being generated. I have two related problems with the output/display.
Whenever I save the file the code is triggered causing each sheet to update and scrambling charts. (To fix this I have to leave the report and then re-enter, which then works fine).

Is there anything I can do to stop this from happening? For example, to avoid the code being run on save or to refresh the active screen. A couple of things I should mention: I already have screenupdating turned off so the user is not seeing each action being calculated. At present to avoid the chart display glitches with complex tasks, I have added a line to my code at the end which moves off screen and then returns to the current screen. That ensures the chart no longer lingers on screen, however it does mean that for a split second a phantom graph appears in the middle of the screen before disapearing.

View 2 Replies View Related

Code Executes 8 Times Without Loop Statements.

Feb 8, 2010

I was playing aroung some VBA code, but the code executes 98 times and I don't know why. For example, range A1 contains 5. When I type, say 3, in A1, I want A1 to show me 8 (5+3). Then I may type 10, in this case A1 must show 18 (8+10). And so on. I decided to place entered values in different column, then sum them in A1 with below stated code

View 3 Replies View Related

Excel 2007 :: Divide Operation Executes More Than Once

Mar 12, 2012

Using Excel 2007.

My vba code seems to be dividing a range by 1M more than 1 time

My initial value is 51543942

After by code runs the display is 0.00 MB and the value in the formula bar is 0.000000000051543942 or 5.15439E-11

I would like the final display to be 51.54 MB

what I might be doing wrong?

Code:
'Format columns
r = .Cells(Rows.Count, 1).End(xlUp).Row
Set rng = .Range("C2:C" & r)
.Range("IV1").Value = 1000000
.Range("IV1").Copy

[code].....

View 8 Replies View Related

Make Sure User Is Within Certain Rows Before Code Executes

Aug 14, 2007

I have created code to enter data from the Active cell. However, I would like to edit it so that the user can only make this work if they are on Rows 6 through Row 29.

Here is the
Sub DropDown7_Change()
'Right here I want: If ActiveCell. is in Row 6-29 Then
Application.ActiveCell.Value = Range("D3").Value
Application.ActiveCell.Offset(, 1).Value = Range("F3").Value
Else Msg = "Move into the proper rows"
End Sub
How can I do a check before the code is executed to be sure the users active cell is in Rows 6-29.

View 9 Replies View Related

MacRO: Check If WorkBook Open. If Not, Open It.

Sep 27, 2006

I did a macro on my mac to transfer a sheet from one workbook to another worbook. It works very well when the destination workbook is open. Therefore I wanted to add some piece of code to check if the destination workbook is open. If not then I wanted the macro to open it before tranfering the sheet. Here is the code I´m using for tranfering the sheet

Sub Transfer_Sluttet()
If ActiveSheet.Index <> Sheets.Count Then
Application.DisplayAlerts = False
Set ws = ActiveSheet
Sheets(ws.Index + 1).Delete
ws.Move Before:=Workbooks("Sluttet.xls").Sheets("sheet2")
'Moves active sheet to beginning of named workbook.
'Replace Test.xls with the full name of the target workbook you want.
Application.DisplayAlerts = True
End If
End Sub

This is the type of macro I useually use on my pc to check if a workbook is open and if not then open it

If IsWorkbookOpened("Filename.xls", "C:Documents and ..................

View 3 Replies View Related

Mouse Click Freezes Screen - Code Still Executes

Jun 16, 2006

it would be possible to have text disappear after being displayed in Excel for a while.

My son and I played around with games (helping create a photographic memory, I told the youngster!) on the thing and until yesterday neither of us noticed that clicking the mouse anywhere (actually just clicking it) causes the screen to "freeze" while the code still happily erases the text in the background.

Hitting ESC allows the screen to cath up to the actual code EVEN THOUGH the ESC key is actually disabled from breaking the code.

View 9 Replies View Related

Macro Coding: Add A Code To The Sort And Paste Macro That Will Open The Second Spread Sheet

Jul 21, 2007

I am making a spreadsheet that sorts and pastes, but I need to know if I can add a code to the Sort and Paste Macro that will open the second spread sheet needed without just already having it open and using the

Windows("estimate sheet one.xls").Activate

View 2 Replies View Related

Excel 2003 :: Macro To Open Folder Then User Selects File Then Macro Continues To Run

Nov 6, 2011

I use Excel 2003 at work. I'm looking for some code that will Open a folder and then lets the user to select a file then continues to run the macro.

The file name they select will look similar to this K2271011.504 or K3011111.201

View 3 Replies View Related

Open File Macro: Same Directory As Macro Workbook

Nov 17, 2006

I created folder on my desktop to hold various documents. I have master excel document which contains forms and command buttons that open documents from same folder. Is there a way to change code instead of having full file path to specify current directory. I'm worried that if I move this folder to another location then my open file button will not work since location is changed.

Also when I open with command button word document, I have a button on word document to close. I can close document but word application is still active. Can I close word application with the document at the sam time. This is the code I'm using: "ActiveWindow.Close"

View 3 Replies View Related

How Do I Apply A Macro To All Open Spreadsheets Except The One The Macro Is In

Dec 8, 2009

I am trying to set up a macro that hides certain columns of data in an automated spreadsheet that I don't need. How do I make the macro that hides the columns apply to all spreadsheets that are open except for the one I am in?

View 9 Replies View Related

Macro To Open And Execute A Macro From Workbook

Jul 20, 2003

Is it possible to use a macro to:

1. Open Excel from the Desktop

2. Open a workbook

3. Execute a macro from this workbook

If so, how can it be done, specially point 1?

View 9 Replies View Related

On Error Trap Executes When No Error

Oct 3, 2006

I was trying to add a popup box so that if no match was found, it would report a popup box stating so.

Well, It runs successfully, however it executes every, single time! LOL

Sub Find_and_Update()

On Error Goto A

Dim Search_Range As Range, Found_Range As Range
Dim SearchFor As Variant, cell As Range

SearchFor = Range("J3").Value
Set Search_Range = Range("A:A")

Set Found_Range = Find_Range(SearchFor, Search_Range, xlValues, xlPart, False)
For Each cell In Intersect(Found_Range.EntireRow, Columns("G"))
cell.Value = cell.Value + 1
Next cell
A:
MsgBox "Not Found"
Range("J3").Select
Selection.ClearContents
Exit Sub

Range("J3").Select
Selection.ClearContents
End Sub

View 9 Replies View Related

Run Macro With More Than 1 Workbook Open

Apr 29, 2009

I currently have a macro set up to run once a workbook is saved/ closed. This works fine unless tehre is more than one workbook open. When I try it with more than 1 different workbook open I get a run error.

My code begins:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

and then performs the macro. I don't really want to specify the filename as this is liable to change. Is there anyway of adding a "this workbook" command to the text string, and if so where would it go?

View 10 Replies View Related

How To Open .jpg Picture With Macro

Feb 23, 2009

I use the following macro to open excel files. Can this be modified to open a picture ppppp.jpg?

. . . or, can someone help me with a new macro that can open pictures

. . . I would still like to have the file checking options to see if the picture is already open and if not, that it actually exists.

View 11 Replies View Related

Macro To Open New Workbook

Dec 16, 2011

if workbook("Result") is not open then
add new workbook and name it "Result + date and time"
else activate workbook "Result"

View 3 Replies View Related

Use Macro To Open Webpage?

Sep 23, 2013

I want to create a macro button that will open a specific webpage. In a cell. I need to press the CTRL + link to access the site, but within a macro I don't know

View 1 Replies View Related

Macro To Open Report

Apr 3, 2007

I download excel report from Business object reporting tool and the file will be very huge something like 25MB and it takes nearly 40 Min to open the report and the data will be merged in the report......can any one suggest what can be done to open the report quickly or can we open the report by using macro.... can we improve the performance of opening the 25 MB report thru macro...

View 9 Replies View Related

Open All Files With A Macro

Apr 30, 2007

If i have a folder with multiple csv files in it, all with different names can i get a macro to open all these files.

I know that i can if they are always the same name each time i run the macro but what i would like to do is to change the name of the csv files daily.

The reason is because i could have upto 50 different files a day.

So basically i'd like to click a button and open all the contents of the folder regardless of the name of the files inside.

View 9 Replies View Related

Macro To Open Another Sheet

Aug 14, 2007

I'm just starting to learn about using macros in buttons to send me to another sheet within the workbook, but what I now want to do is have a drop-down list that when I click on one of the entities in the drop-down list, I'm sent to that particular sheet

View 9 Replies View Related

Macro - Copy A Row To Next Open Row

May 16, 2008

I looking for a macro to copy one row to a new sheet, but I need it to place it in the next available row in that sheet. For example, in the screen shot below, I need the range of b3 to o3 copied over to sheet 2, and placed in the next available row starting in column B. Hope that makes sence....

View 10 Replies View Related







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