Over 1 million tech questions and answers.

Excel macros

Q: Excel macros

I would like to do something very simple, but that will affect over a hundred tables.

I would like to automatically, via a macro, place the table heading into the header. The table heading is in cell b5 on all tables. Therefore I need to write a macro that will go through each worksheet (they are in 4 workbooks, but I can do the same macro in each workbook) and perform this action.

I have read masses of help and tried lots of different ways and it WILL not work.

I have used for and next, and other loop arrangements. I have used the worksheets function and the activate.worksheet function. But nothing will work.

This is the line that it does not like:

ActiveSheet.PageSetup.LeftHeader = Range("b5").Value

I have tried different configurations of this line and used different functions within it, but nothing has worked.

Does anybody know what I am doing wrong?

Would appreciate any guidance anyone can give me.

RELEVANCY SCORE 200
Preferred Solution: Excel macros

I recommend downloading and running Reimage. It's a computer repair tool that has been proven to identify and fix many Windows problems with a high level of success.

I've used it in the past to identify and fix everything from blue screens (BSOD's), ActiveX errors, corrupt files and processes, dll/exe/sys errors, recover lost memory, Windows update problems, defragging, malware removal etc.

You can download it direct from this link http://downloadreimage.com/download.php. (This link will automatically start a download of Reimage that you can save to your computer.)

A: Excel macros

Read other 6 answers
RELEVANCY SCORE 69.6

I have a report that contains macros to update all the information that is put in. It is in excel 97 and my business just recently updated to 2003 and now I get a compile error when I run the reports. How can I fix this error?
 

A:Solved: convert excel 97 macros to excel 2003 macros

Read other 8 answers
RELEVANCY SCORE 58.8

I am trying to open a spreadsheet that was created in Excel 97 using Excel 2000. The links and macros that are on the sheet seem to prevent it from opening. There are a load of error messages but I just cannot get the thing open. I have searched so many places, found the same problem but no answer.

Can anyone help?

Leanne
 

A:Excel 2000 problem when opening Excel 97 spreadsheet with links and macros

Welcome to TSG.
Can this file be opened fine in Excel 97? Any chance that it is corrupted?
What are some of the error messages you are getting?

 

Read other 3 answers
RELEVANCY SCORE 58.8

I have just been upgraded to Excel 2007. I find that some of the macros that were recorded in Excel 2003 no longer work in Excel 2007. We use the Analysis Toolpak VBA add-in and I have added this in to 2007 ok, but when running a macro I get a run time 1004 error ATPVBAEN.XLA cannot be found. After some searching it would appear that some of these functions have been renamed in 2007 e.g. it is now a .XLAM file rather than .XLA which is why the macro code can't find it. I guess I could manually edit all the macros and change the fucntion names but there are other colleagues in my team that are still using 2003, so I don't want to break things for them. Is there any solution to this? Thanks
 

A:Solved: Problem with Excel 2003 macros in Excel 2007

Read other 8 answers
RELEVANCY SCORE 58

Hi can anybody tell me hoe to copy macros from excel 2003 to excel 2007?
The excel 2003 is running under windows xp and the 2007 under windows vista.
(The two versions of excel are installed at differnt computers)

A:Copy Macros From Excel 2003 To Excel 2007

I don't know Excel 2007 nor Vista.
But the usual way to copy macros brute force would be to open the VBA toolbar, get into the Modules, select each, and Export one by one. Then import into 2007 modules if Excel 2007 VBA permits that.
If export/import doesn't work, you can always copy out the entire text into Notepad text files, and copy/paste from the Notepad into your 2007 Excel.
If the VBA language or object model has changed between 2000 or 2003 and 2007, then some tweaking might be in order, but I suspect they left it alone, and the error messages, if any, might suggest what to fix.

Since these are different computers, either network them and share some common directory, or use USB flash drive for transfers of the, say, Notepad files.

Export is good, because it names the modules. They get saved someplace in your local settings. Notepad will not name, and doesn't matter really.

Read other 3 answers
RELEVANCY SCORE 57.6

I have an excel file that look like the photo below

I need hyperlink each box (A, A1, A1a...B4) to a new excel file. Therefore if I click on A, a blank excel file will open. I have to hyperlink hundreds of these boxes on the excel file I am working on and is very time consuming to do so.

I was wondering if it was possible to create a macros to automate the creation of a hyperlink and that hyperlink leading to a blank excel file.

I do not care what the title of the new excel file is named. What I care about is that all of the new excel files go to a specific folder.
 

A:Excel Macros - New to macros. Please help

Read other 6 answers
RELEVANCY SCORE 57.2

Hey all,

Does anyone know if it's possible to convert macros from Excel 97 (Excel Basic) to Excel XP/2002 (Visual Basic) ? Or do I have to do these manually?

Any help is appreciated

Thanks!
 

A:Help!! Convert Excel 97 Macros to Excel XP (2002) ???

Read other 9 answers
RELEVANCY SCORE 54

I have made a number of maths worksheets/games in excel. I have never learned programming, but I have picked up bits of visual basic from friends and from the "record macro" function.
I'm attaching an example of the type of structure I'm using. I really like the way I can make buttons to click for the kids to enter their answers, so that everything is done with a mouse. I often put timers on so that they're working against the clock.

I would like to write something similar for multiplication table practice. I would need a number pad of answers from 1 to 100. There must be an easier way to do this than to write 100 short macros equivalent to the 4 answer macros in my example.

Can anyone help?
thanks
 

A:please help with my excel macros

Read other 16 answers
RELEVANCY SCORE 54

Im trying to select rows continus until a cell equals a certain value, acting as a select end so to speak then the selected values can be copyed onto another sheet. and sugestions??
 

A:EXCEL macros

Hi, welcome!

Can you explain what you want a little bit more? You need to be as specific as possible. Examples help.
 

Read other 2 answers
RELEVANCY SCORE 54

I need help...

I need to create a macro that imports a text file, but the text file name changes daily (ie 05092007.txt for the file polled on May 9, 2007).
Ideally, the user would input the date to load and the macro would import the corresponding file.

When I set up the macro using the recorder, based on the file I click I get this:

Cells.Select
Selection.ClearContents
Selection.QueryTable.Delete
Range("A1").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\sam7000\stores\townsqr\poll\05092007.TMP", Destination:=Range("A1"))
.Name = "05092007"

I would like to change date part (05092007) based on information entered in an input box.

Any help is appreciated
 

A:Excel Macros

Read other 11 answers
RELEVANCY SCORE 54

I do not know how to write code - I typically use the Record a Macro function for all my Excel needs; however, I need to create a macro that opens a new email, puts my email address in the To: field, fills in the Subject field and puts specific text in the body of the email... and then sends that email msg.

Anyone provide me with how to accomplish this within Excel?

Read other answers
RELEVANCY SCORE 54

I have recorded a macro to sort some data using text to columns. Part of the data is time based on a 24hr clock and formatted as (custom) hh:mm:ss. When I run the macro it changes the data to time on a 12hr clock and introduces another column using am and pm.

The next step is to compare the data using an 'IF' statement to find differences of times for certain conditions. The fact that the macro has taken upon itself to change the time from 24 to 12hr clock thereby gives erroneous results.

So; my question is: why does the macro do that?

Xtech
 

A:Excel macros

Read other 7 answers
RELEVANCY SCORE 54

Hi,

Does anyone know a way to put a button or something into a spread sheet that will clear all checked radio boxes?

Thanks,
Dan
 

A:Excel Macros

Read other 8 answers
RELEVANCY SCORE 54

Hi All,

I have been given a task by my ops to send automatic feedback emails to user who have called use for IT support. The need is to sent up Macros in excel to do this once i extract the information from CRM. I seriously have no clue what so ever for a complicated macros. The information which i will be extracting is Ticket Number / Agent who handled the call / Users email address / What the issue was. The catch here is that there will be 30 or more tickets created by a Agent per day and the macros should be in such a way that it should send 5 random feedback emails for one Agent per day or may be a week.

Im good at extracting data into Excel but not in Macros which will send automatic feedback emails to users.
The Body of the email will be

Hi (XYZ)

Please take a quick moment to fill in the survey for a call made to IT Support.
Below is the sharepoint link please click on it and complete the survey which would take 5-6mins of your time.
Thank You.

IT support Feedback Team.
 

A:Excel Macros

Hi, welcome to the forum.
There are several postings about the saem type of questions and the macro's there can be used. I suggest you do a quick search to locate them.
Another important thing to mention is the version of Excel you're using.
 

Read other 3 answers
RELEVANCY SCORE 54

Maybe your expertise in Cell Naming procedures can solve this dilemma for me. Let me step you through this simple problem.
Step #1 Highlight a specific cell (?E7?) on the worksheet.
Step #2 Initiate the running of the Macro named ?Next?. (See macro below)

Sub Next()
ActiveWorkbook.Names.Add Name:="Next", RefersToR1C1:="=GENERAL!R7C5"
ActiveWorkbook.Names("charge").Comment = ""
Command
Command
Command
Application.Goto Reference:="Next"
Selection.ClearContents
End Sub.

The ?Add Name? command, shown above was learned by using the ?Record Macro? facility. You will note that in addition to naming the ?ActiveCell? as desired, it also adds the exact cell location being named. This works fine for the first running of the macro. Because of the naming of the cell in the Macro?s first run, subsequent runs of this macro always names the same cell. It is apparent that this cell location is written in stone for all duration.
What I am searching for is a ?generic? cell naming command, one that names the active cell without identifying the specific cell being named.
Any thoughts on this problem?

Thanx, Bill

A:Excel macros

MOving thread to the Office section of the Forum for better results.

Read other 1 answers
RELEVANCY SCORE 54

I'm opening an Excel workbook in Excel for Mac with macros done in Windows. I can't create new macros, is that right? I'd just like to make some changes to multiple sheets without doing it manually and don't understand the help references to using applescript. Help, pease!
 

Read other answers
RELEVANCY SCORE 54

I have a very large mailing list on Excel 2002 to which I make corrections as address changes come in. This list is used for several different mailings and I'm having a problem keeping track to be sure the most current corrections have been posted. Is there any formula or macro to be placed in a column to automatically insert the current date (and KEEP it that date) whenever a correction is made to an address? I have tried to manually enter the date when a correction is posted but the date keeps changing to whatever the current date is. It has been quite some time since I tired writing a macro and don't really remember how. (Actually, I think the macros I wrote were in Lotus 123 rather than Excel.) Any ideas greatly appreciated.

One other question. I've been entering zip +4 but when I use this list to print labels with Word 2002 Mail Merge Wizard, it will only print "0" for any zip codes with the additional four numbers. Is there any way around this?
 

A:Excel macros

There are 2 things you can try (& a formula ain't one of them )

1. Use the shortcut to enter current date ( CTRL+; )

2. Use some event code in the worksheet module (rightclick the sheet tab & "View Code" to access the module):

Private Sub Worksheet_Change(ByVal Target As Range)
If Selection.Cells.Count <> 1 Then Exit Sub
If Target.Column = 1 Then
Target.Offset(0, 1) = Date
End If
End Sub

This will enter current date in column 2 (B) when you make a change in column 1 (A).

For the zip codes merge field formatting, try here.

HTH,
Andy
 

Read other 2 answers
RELEVANCY SCORE 54

Hi all,
I am needing to write macros in Excel -
and was wondering if anyone out there could direct me to
an easy way to wtite them - templates, software, free tutorials on line - anything.

Any help is appreciated.
Thanks,
Thee
 

A:Excel Macros

Hi, Thee.

Free Lesson 1, and over 500 macros in a knowledgebase. All free.
www.vbaexpress.com
 

Read other 2 answers
RELEVANCY SCORE 54

I was wondering if anyone could help me out with a problem I am having.
Here is an example of what I need:

Main Sheet of which we will be pulling information from is
Gross Log
Then numerous sheets for employee numbers

If cell c5 = "244" then
that number 244 will have the cells from Gross Log go to the number of which the cell has in it.
A5, B5, C6, C7 for example will go to 244's sheet

Else if c5 = "723" then
that number 723 will have the cells from Gross Log go to the number of which the cell has in it.
blah blah blah

If you would like to see the file, I am willing to send the attached file to you if you provide me with your email.

Mine is: [email protected]
Thanks!!!!!
 

A:Excel Macros

Not an Excel kind of guy, but welcome to the team! A word of warning: if you go in random you WILL get hooked Sorry I couldn't help.
 

Read other 2 answers
RELEVANCY SCORE 54

Greetings everyone,

I'm very new to macros in Excel 2007, although I have found codes that work for my purpose so far.This is for a game idea a friend and I came up with. We have 108 character slots; some of which have already exist, but not all. The characters are identified by three traits: number, name and ability. I have a worksheet with the data for the existing characters. For the ones that don't exist, I want them to be randomly generated using a pool of names and traits that my friend and I have compiled. Here's an example of what I'm trying to say:

#1. Tinker -- Wrench
#3. Soldier -- Firearm
#4. Spy -- Knife

How do I copy a list like that above from one worksheet to another, while randomly generating a new character (name and trait) in slot #2?

Thanks in advance!
 

Read other answers
RELEVANCY SCORE 54

Is it possible to use "if" formulas in the macro code? If so, where is a good place to begin learning about these?
 

A:Macros in Excel

The two things that VBA uses more than anything to control how they run is if/then and loops.
There is lots of code on this forum and also on the VBAX forum as well.
Or you could buy a book of course.
 

Read other 2 answers
RELEVANCY SCORE 54

Help with Excel 2007!

I have recently created an Excel workbook but I do not want people deleting certain sheets.

Below is a screenshot of what I am talking about.

Is there any sort of Macros/visual basic code that can do this?
 

A:Need help, Excel Macros

This link gives somehints
http://msdn.microsoft.com/en-us/library/aa141022(office.10).aspx

I know there was a link explaining all the commands and where you can either enable / disable them, amongts these are the delete, copy, paste, etc.

I'll see if I can find it and post it but the above link may lead you in the right way and link to other links
 

Read other 3 answers
RELEVANCY SCORE 54

Hey Friends,

Can anyone help me out? I want to navigate through last populated cell of the spresheet and then want to move one cell down... Macro function requird.
 

A:Macros in MS-Excel

Are you talking about a particular column or could this last populated cell be located anywhere in the sheet?

Rollin
 

Read other 3 answers
RELEVANCY SCORE 54

In Lotus 123 you can "step" a macro enabling you to run the macro line by line - is it possible to do this in Excel?

If so can somebody point me in the right direction please?

Thanks in advance,

Moll
 

A:Excel Macros

Read other 6 answers
RELEVANCY SCORE 54

Hello, I'm trying to open a spreadsheet that I know has macros within it. I can open it successfully in MS Excel, but my question is:-

Does anyone know of an alternative to Excel that will still run the macros, I've tried 602Tab but it won't run them, unless I'm missing something of course.

PP
 

A:Excel Macros

Read other 8 answers
RELEVANCY SCORE 54

Can someone tell me how you copy a macro from a "worksheet"
into a "Personal Macro Worbook", I beleive you do this in Visual Basic? Can't quite figure it out!
 

A:Excel Macros

hi ibm37....

you can just drag an existing module from any open workbook into the Modules folder of the Personal XLS file.
(and you need to have the Project window open).
This does not remove (or move) the module from the original Workbook (it acts like "copy").

or...
you can just copy the desired Sub (or Subs) from any module and paste them into any existing Modules in the Personal XLS file.

This is all done as follows:
Tools/Macro/Visual Basic Editor

I hope that this is what you were asking.
k
 

Read other 2 answers
RELEVANCY SCORE 54

I've created a rather large excel vb project that will be available to use by other members of my department. I've locked my code, but I would like to create an exe file so that they can just run it. I assume this is some type of add-in, but if you know the trick please fill me in!

Thanks,
Ca1Ga1
 

A:Excel Macros exe

its written in VBA.
 

Read other 1 answers
RELEVANCY SCORE 54

I created a macro to extrract some data but when i run it an error occurs and it states that the procedure is to long is there a way to solve this?
 

A:Excel Macros

Read other 8 answers
RELEVANCY SCORE 54

I have recorded a macro to sort some data using text to columns. Part of the data is time based on a 24hr clock and formatted as (custom) hh:mm:ss. When I run the macro it changes the data to time on a 12hr clock and introduces another column using am and pm.

The next step is to compare the data using an 'IF' statement to find differences of times for certain conditions. The fact that the macro has taken upon itself to change the time from 24 to 12hr clock thereby gives erroneous results.

So; my question is: why does the macro do that?

Xtech
 

A:Excel Macros

Read other 16 answers
RELEVANCY SCORE 54

Anyone know of how to create Macros using Excel, beyond using the Recorder but without having to learn VB.
 

A:Excel Macros

Read other 6 answers
RELEVANCY SCORE 54

I have created a macro that makes a number of changes in a workbook including unhide worksheet, changing format etc. It works fine. The problem is when I try to continue by copying the altered worksheet to a new workbook. I want to run this on several hundred files and add the altered worksheet to one file. I get a variety of error messages. I have tried it with both workbooks open or I open the new workbook. I looked at the VB code and think it has something to do with the relative positioning (pathway to workbook) I have tried every variation that I can think of. There maybe a simple solution. I have not worked much with macros in Excel.
 

A:EXCEL macros?

Hello,

Can you post your macro so we can look at it?
 

Read other 2 answers
RELEVANCY SCORE 54

Excel macros, I tried to create a very simple macro in Excel, that would
> change a credit number to a negative for addition, 1.32cr to -1.32,
> after recording the macro, I ran it, the macro changed the credit to the
> negative number that was used when I created the macro, this is a very
> simple Macro & I ran it in Lotus, F2(Edit)Home,-,End,BKSPC 2, Visual
> Basic does not show these keystrokes and I can't seem to correct, I get
> Syntax error. Pls help. Lloyd
 

A:macros in Excel

Lloyd:

Put a -1 in a blank cell somewhere, then copy that cell. Then select the credit number cell(s), and hit Edit-Paste Special, select multiply and hit okay.

Record that.

Or replace your macro code with this:

Selection.NumberFormat = "-#.##"
Or, if you already know where the credit numbers will be, just format that area:

Format-Cells-Special and type in -#.##

That's for 2-decimal numbers. If you can't figure this out, email me file and details.
 

Read other 3 answers
RELEVANCY SCORE 54

I have to write a Excel Macro to do different checks and do changes
accordingly .

Here are the checks.
1.Filter the data by current month and copy only that data to a new
sheet with current month name.
2.There is a hyperlink in one of the field.Its a file path on the
network.So the macro should check if the file exists at given location and
also check the filename length.If the File doesn't exists or File name
is greater then 56 characters then it should copy these rows to new
sheet called"Exceptions" and mention the Failure reason as
either "File doesn't exist" or "File name is more then 56 Characters"

4.Macro should run automatically.

Is there any way i can send the sample excel data for this Macro.
I am totally new to Excel Macros.Your help would be greatly
appreciated.

Thanks,
Sree.
 

A:Need help with Excel Macros

Read other 12 answers
RELEVANCY SCORE 54

Is there any info regarding converting Lotus macros into Excel macros? I realize they are 2 different languages, but looking for a miracle to make life easier. Thanks.
 

A:Excel Macros

There's a translation doc (Word) here -

http://support.microsoft.com/default.aspx?scid=kb;en-us;148240

HTH,
Andy
 

Read other 1 answers
RELEVANCY SCORE 54

Hi,
I am trying to write a simple macro, where it unlocks the protected sheet and unhice the spreadsheet which is protected by a password. Below is the script of the macro but it doesnt work and come up with following error.

Run-time error '1004'
The passowrd you supplied is not correct. the password is POAFD. i acan notice in the macro that it is not recording the password at all may be that is the reason.

Can some body help?????


Sub POUNLOACK()
'
' POUNLOACK Macro
'
' Keyboard Shortcut: Ctrl+u
'
ActiveWorkbook.Unprotect
Sheets("PO").Select
Sheets("Upload").Visible = True
End Sub
 

A:Excel Macros

Read other 7 answers
RELEVANCY SCORE 54

Hello techsupportguy,

Im not sure how complicated it is to be but its something like this....
Sheet1
x1=x2 ? [] <==== drop down menu. yes or no.
x1=[0]
x2=[1]

qty=[4] <==== this means x4 slots
[ ][ ][ ][ ]

now when I press run, I want it to generate all the possible ways to combine x1 & x2
[0][0][0][1]
[1][1][1][0]
[0][0][1][1]
[1][1][0][1]

basically it generates all the different ways to combine x1 and x2.

Sheet2
All the numbersets output to this sheet.

Im glad to help me....
 

Read other answers
RELEVANCY SCORE 54

Hi all,
I am needing to write macros in Excel -
and was wondering if anyone out there could direct me to
an easy way to wtite them - templates, software, free tutorials on line - anything.

Any help is appreciated.
Thanks,
Thee

A:Excel Macros

Thee Ox,Is this the sort of thing, you're looking for? If not please let us know. Hope this is of some assistance.Be (macro) SafeDa Animal

Read other 1 answers
RELEVANCY SCORE 54

Can anyone help?!? I'm quite fluent with MS Excel and formulas and such, but now I'm venturing into macros, and all I can say is.... huh?!?!?!
I've used the help file, and it might as well be written in another language for all the help I've gotten out of it! See the attached file to follow along with my description of my problem.
All I want to do is have a check box (already inserted in cell B4), that when clicked, will turn the cell next to it (C4) yellow to highlight it, and then post a string of text in another cell (A9).
No doubt this is all painfully simple to those familiar with macros, but I'm completely and totally clueless. According to the help files, I need to understand visual basic programming language, and I don't... it gives examples of how to make a macro to highlight the color of a cell, like I'm trying to do, but again... huh?!?! (see below)
Static OldRange As Range
On Error Resume Next
Target.Interior.ColorIndex = 6 ' yellow - change as needed
OldRange.Interior.ColorIndex = xlColorIndexNoneSet OldRange = Target
End Sub

Is there anyone who can walk me thru the process of highlighting the cell, and posting my text string? Please!

Steve

 

A:Macros in MS Excel

Stevrford:

No offense to anyone here, but there are better places to get these kinds of answers a lot sooner.

1. Go to www.theofficeexperts.com/downloads.htm and download Userform Training. That might help a little bit for some stuff.

2. For many references:

http://j-walk.com/ss/excel/index.htm
http://www.cpearson.com/excel/topic.htm
http://www.bmsltd.co.uk/Excel/SBXLPage.asp

3. Forums:
http://www.theofficeexperts.com/forum/
http://www.ozgrid.com/forum/
http://www.mrexcel.com/board/
 

Read other 2 answers
RELEVANCY SCORE 53.6

Hi All, I get the error message "Procedure too long" for this macro that I am writing. I cannot seem to break the macro into sections as recommended. Please help!!

Thanks!!
 

A:Help Needed in Excel Macros

Read other 11 answers
RELEVANCY SCORE 53.6

I would like a macro that will compare Accounting system data and Bank statement data. I am comparing the date and amount for an exact match. If there isn't a match, I need the macro to list the exceptions. I am using Windows XP.
 

A:Using Macros in Excel 2003

Read other 10 answers
RELEVANCY SCORE 53.6

Can somebody please let me know how to record a macro that is able to run in every workbook i open?

thanks
 

A:Solved: Excel Macros

Basically, on places their macros in a single worksheet that is saved in Personal.XLS, which starts every time you open Excel. For a more complete description, read here
http://personal-computer-tutor.com/personalxls.htm
 

Read other 3 answers
RELEVANCY SCORE 53.6

What is the best and easiest way to learn to write macros in Excel? My GM at work is bugging me to learn this. He said he would pay for any classes, books etc. that I may need. Might as well take advantage of this.
 

A:writing macros in Excel

Record a macro in Excel, then view it in the code editor. Classes and books would also help. Maybe even some multimedia video training (expensive).
 

Read other 5 answers
RELEVANCY SCORE 53.6

Hi!

I desperately need some help with some excel macros, can anybody help please?

I need the VBA code so that an excel macros will run once automatically when, for example cell A4 = 1.

Using a great thread posted by Zack Barresse, I've managed to get this far with the VBA:

Sub copytohere()
If ThisWorkbook.Sheets("Sheet1").Range("A4").Value = "1" Then
Range("A1").Select
Selection.Copy
Range("E1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("A1").Select
Application.CutCopyMode = False
Selection.ClearContents
End If
End Sub

I dont think I've got it quite right though...
Can anyone help please?

This macros is basic - all it does is copy data from cell A1 to E1 and then deletes A1.
I was hoping the IF statement would make the macros run once automatically when cell A4 = 1 however when I enter 1 into cell A4 nothing happens.

What is interesting is that if i then go to run the macros manually, it will perform the macros correctly if cell A4 = 1 .If cell A4 doesn't equal 1 and I run the macros manually, nothing happens.

I need the VBA so that the macros will run once automatically when cell A4 equals 1.

Any help si much appreciated.

Thank you!
Paddy
 

A:Solved: Run Excel Macros IF...

Hi there, welcome to the board!

If you want something to occur "automatically", you'll need to utilize an event. There are different events you can 'capture' or 'hook' in Excel, as it's commonly referred to. What it sounds like to me that you will need is either a change event or a calculate event.

The change event will fire every time a cell is changed. So if a user starts typing in a cell and hits the Esc key, a change event will not have occured, as opposed to them hitting Enter, then a change event has occured.

The calculate event will run every time the worksheet is calculated, regardless of a sheet change. This may be beneficial if A1 houses a formula which will update from other cells within the workbook.

I'm going to assume you want to utilize a calculate event, but you can use a change event if you want. I'll post both code snippets, so choose the one you want. Both of these are worksheet module code events. To put there, right click your worksheet tab, select View Code.
Code:
Private Sub Worksheet_Calculate()
If Me.Range("A4").Value = "1" Then
Application.EnableEvents = False
Me.Range("E1").Value = Me.Range("A1").Value
Me.Range("A1").ClearContents
Application.EnableEvents = True
End If
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
If Me.Range("A4").Value = "1" Then
Application... Read more

Read other 3 answers
RELEVANCY SCORE 53.6

The company that I am doing internship for has a file in excel that needs to be updated. They keep informations of different companies in one sheet, and each sheet is named by diferent months. Every time each company pays the bill, the "Status" cell is classified as "paid", else "unpaid". When "unpaid" cell are still the same by the time the next month arrive, all this companies that didn't pay yet are copied to the next sheet, which is the next month.
Example:
I have the following Columns (They keep informations of different companies):

Debtor, Shipment Status, Invoice, Broker Code, Amount, Status, Amount Paid, Date and Shipping Date.

I wanted to create a formula or Macro to transfer all these unpaid info to the next month's sheet automacticaly, and leave the paid one where it was...
How do I do that?
 

A:Excel Formulas or Macros

ZIP and attach a sample workbook to your next post and either me or someone else will write the code for you.

Rollin
 

Read other 3 answers
RELEVANCY SCORE 53.6

I was weaned on spreadsheets by the use of lotus 123. With lotus, when composing a macro you could insert a pause to allow manual input into a cell and then resume the macro. I cannot see any way of doing that in excel but am I wrong? Any help would be much appreciated.

Bob
 

A:pausing macros in excel

Read other 9 answers
RELEVANCY SCORE 53.6

I created a series of macro's in an excel spreadsheet.

Once all of the macro's functioned correctly I created another macro to run them in a sequence.

This Sequencing Macro contained the macro name to execute but also includes the name of the spreadsheet. When I attempt to create a new spreadsheet the macros will not run because they cannot find the macros. The reason they can't find them is the Macro refers to the spreadsheet where they were created. I attempted to remove the reference to this spreadsheet and just run the macros but it failed with the error message that it cannot find the Macro

How to I go about creating a Macro to run the other Macros in sequence without referring to the spreadsheet where it was create?

Here is an example of the sequencing macro.

( Obviously, 'FEB1953-YABLleagueStatSheets.xls' is a reference to the spreadsheet where it was originally created. )
Application.Run "'FEB1953-YABLleagueStatSheets.xls'!Pitcha"
Application.Run "'FEB1953-YABLleagueStatSheets.xls'!Pitch1"
Application.Run "'FEB1953-YABLleagueStatSheets.xls'!Pitch2"
Application.Run "'FEB1953-YABLleagueStatSheets.xls'!Pitch3"
Application.Run "'FEB1953-YABLleagueStatSheets.xls'!Pitch4"
Application.Run "'FEB1953-YABLleagueStatSheets.xls'!Pitch5"
Application.Run "'FEB1953-YABLleagueStatSheets.xls'!Pitch6"
Application.Ru... Read more

A:Solved: Excel Macros

Read other 15 answers