Computer Support Forum

Need Macro to automate email from excel

Question: Need Macro to automate email from excel

Windows 7 --------------------------------------------------------------------------------First thing...I know nothing about macros!! I do know a very little about formulasI have created "IF" formula in excel 2010, based on a date it will create a send due in column "E", =IF(D5=$A$2,HYPERLINK(mailto:"&$K$1&"?subject="&A5&-B5&"&body="&$C$3,"sendworks great but, I have to go thru 86 rows in column "E" and hit "Send Due" numorous times,then hit send again on all the emails, can we automate this some how, like a macro that engadges when I open my outlook every morning?Thank u

Relevance 100%
Preferred Solution: Need Macro to automate email from excel

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.)

Answer: Need Macro to automate email from excel

I have written code in Outlook, which is essentially a template, you fill in the details, all sorts of stuff happens accordingly to what you have selected, and you press send and it will send the emails to whoever it is you want. Iv done this in Outlook, so my question is, why do you need this to be done in Excel? is Outlook acceptable?

3 more replies
Relevance 86.51%

Hi all. This is my first question. I've searched the forums and can't find anything quite like I'm trying to do, even though it seems a fairly simple thing.

Background:
I am writing an application which will pick up csv files from a folder and put them in a database. This needs to be mainly done in IS in SQL Server 2005 for corporate reasons. However, the problem is that the data is not editable in IS. I am using XP and Office 2003 and SQL Server 2005.

Problem:
I have written an Excel macro to edit the data into a form that imports into IS and then a database, but the requirement is to automate the process. The source csv files will arrive with unknown names and at unknown times. Therefore the macro cannot be included in the individual files, and has been put in Personal.xls. Eventually, the IS routine will loop round and apply the editing and import to every file found in the particular folder.

Now, forget all about the IS side - I can do that later. What I'm trying to do is to Open Excel with a given spreadsheet name and then run the macro from personal.xls. I do not want this to run every time I open any spreadsheet, just named ones. The macro has a shortcut key - (^+)Q as it happens - and one idea I had was to try to send this as a key to Excel. I can do it from an Access macro, which would do, except that I would have to enter the spreadsheet name into the Access macro every time, which defeats the object.

The closest I've got was to overwri... Read more

More replies
Relevance 68.88%

Any way of controlling the time a email is sent via a excel spread sheet using vba?
 

Answer:Excel - macro email-

6 more replies
Relevance 68.88%

I have an Excel model (office 2000) which has a range of cells that contain if/then statements. I'm trying to get Excel to automatically send an email if any of the cells within that specified range were to provide a value that was false. Is this possible? Thanks for any insight.
 

Answer:Email Macro in Excel??

16 more replies
Relevance 68.88%
Question: Excel Email Macro

Hi All,

I have a spreadsheet and i am needing to create a macro that will opena new message in Outlook and populate the 'To' Field with one cell and then the 'CC' field with 2 email addresses, one from one field and the other from a different field. then the subject from another field and then the body from another. it then leaves the message window open so i can check it right and hit send.

I found the script the other day but can not find it anywhere including this site.

Any help on this will be great.

JPL

Any
 

Answer:Excel Email Macro

Hi JPL,

You could use this function, just pass the values to it
Code:

Function MailData(mSubject As String, mMessage As String, Sendto As String, Optional CCto As String)
Dim eSubject As String, EBody As String
Dim app As Object, Itm As Variant
Set app = CreateObject("Outlook.Application")
Set Itm = app.CreateItem(0)

With Itm
.Subject = mSubject
.to = Sendto
If Not IsMissing(CCto) Then .CC = CCto
.Body = mMessage
' .Attachments.Add (NewFileName1) ' Must be complete path
.Display ' This property is used when you want
' .send
End With
Set app = Nothing
Set Itm = Nothing
End Function

It's from one of the posts, I do not remember which one
 

1 more replies
Relevance 68.88%
Question: Excel Email Macro

Hi

I am trying to write a macro in Excel 2003 to automatically send an email using Outlook to a list of individuals asking them to confirm their personal details using the attached template. Could someone show me where I am going wrong with the script please?

Many thanks
 

Answer:Excel Email Macro

16 more replies
Relevance 68.06%

My sense is this is a pretty simple request, but I'm completely illiterate when it comes to VB.

I have an excel spreadsheet with a number of data points. I'm looking to export the entire sheet to a CSV file and send it via Outlook. Any suggestions?
 

More replies
Relevance 68.06%

I have a user who wants to create a macro which will automatically send an excel spreadsheet into outlook and email it.
Any suggestions welcome. Thanks.
 

More replies
Relevance 68.06%

Hello all;

I am new to this forum and also to Excel macros. I have a large Excel file detailing financial accounts with my small business.
Anyway, I would like to email any customer who has an overdue balance as per column V in my attached sample file (any customer with a greater than zero value in V). I would like to send an email; something like this:

Joe Wilson;
As of 2/28/11 (latest date in the row that is on/after the current date), your account is currently overdue and you owe $1500.00 (G3).
Thank you.
Treasurer
I found several other threads explaining how to send an automatic email from Excel, but I haven't found one for sending an individualized email to a list of recipients. If this question has been answered, please feel free to redirect me. Otherwise, I'd appreciate any suggestions. Please let me know if I can detail my needs any better.
Thanks!
 

Answer:Excel Macro: Auto Email

welcome to the board.

I put some code in the sheet

The macro name is CheckAndMail

Let me know if this is what you need

PS: I just corrected something I came accross and have re attached the corrected sample
 

2 more replies
Relevance 67.24%

I would like to ask for an Excel macro which can send an automate email on a certain date every Month.

The dates would be as follows:

1st Monday: Email should be sent to [email protected] automatically
2nd Wednesday: Email should be sent to [email protected] automatically
3rd Tuesday: Email should be sent to [email protected] automatically
3rd Tuesday: Email should be sent to [email protected] automatically
3rd Tuesday: Email should be sent to [email protected] automatically

Subject line: ABC123D5679_Data transfer expected today

Details of the body of the text message:

"Dear All,
This is to remind you that we are expecting the data transfer to be posted in Novartis system today . This is just an advanced intimation.

Kindly let us know if you foresee a delay in the data transfer.

Kind regards,
Rohit"
Many thanks in advance for your help guys. This means a lot.
 

More replies
Relevance 67.24%

Hi - I have a list of names for a particular company where I have the first name and last name of the customer plus the email naming convention their company uses. For example the company's email naming convention is: [email protected] Is there a way I can create an Excel Macro that will automatically create the email from the available information? For example if I create three columns where one has the first name, last name and the @companyurl.com?I hope someone can help with this as it will save a lot of time!!Thank You!

Answer:Need Excel macro to creat email address out of just a name

This can be done fairly easily, but I'm not going to offer any suggestions.Since it appears that you do not work for this company, I can only assume that this will be for some sort of mass, unsolicited mailing. If your project was sponsored by the company in question, they would supply you with a distribution list and you wouldn't have to build your own.For all I know, I'm on that list of names that you have and I don't need any more unsolicited email.Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.

3 more replies
Relevance 67.24%

Hi there,

I have a workbook which i would ideally like to send an automated mail when the date is within 30 days of "Todays date" .
I have found something similaar on past posts whichprints certain cells to an email but is triggered by a button press not date, but wondered if anyone could adjust it for me as my excel knowledge is very limited.
I really am struggling.

The password for the spreadsheet is Kalibratedbyme (capital K)

Best regards and many thanks!
 

Answer:macro to allow a date to send an email in excel

The content is different but why are you duplicating a post?
 

3 more replies
Relevance 67.24%

Hello

I need to come up with a simple outlook macro (or script?) that fires off whenever a new email meeting certain criteria is received.

1. new email is received with "please refresh quotes" in the subject
2. outlook runs a macro that causes another macro to run (the second macro is located in a excel workbook which is already running in my office pc)
3. the excel (attached) is simply refreshing market prices and emails whenever the macro is triggered. because the quotes are obtained via a DLL feed I can only get it at work.

the purpose is simply to get live market quotes on my personal email from my work email whenever i need.
thanks in advance for your help.
 

Answer:Solved: Run excel macro when new email is received

9 more replies
Relevance 66.42%

Hi there - Using MS Access 2007.
I have a FORM with a macro that runs a query to generate ONE excel file and attaches to email using MS Out look to send out. - That Works great.

Problem: Multiple users to send email & attachment.
I would like for the macro to generate excel file (S) - based by the UID.

Can someone suggest a better way of handling this that is not time consuming?

Thanks In advance!
 

Answer:MS Access 2007 - Macro > Excel > Auto Email

Access can open Outlook and send an attachment to mutiple recipients either as a list or as individual emails.
So are the attachments all the same for the recipients?
 

1 more replies
Relevance 66.42%

Hi:
I am very new to Excel 2007 and macros. I have a spreadsheet that I am trying to get to send an email reminder to the point of contact [ col b ] 5 days prior to the closure document due NLT date [ col m ]. I am looking for assistance in writing a macro which will accomplish this if it is possible. I have attached the spreadsheet that I referenced.
Your assistance would be greatly appreciated.
Thanks in advance.

desantisj
 

Answer:Excel 2007 Macro to Send Reminder Email

desantisj, welcome to the Forum.
There are already 3 or 4 posts on this forum that have the VBA code (Macro) that you can modify for your Workbook if you can read the code. Zack has written the code so it is a bit complicated, but it should be a case of substituting your Cell references that hold the data for the ones that others have used.
Otherwise it is a case of waiting for an Excel guru to come along and help. If none of them come along I can probably help you, but I normally work with Access.
 

2 more replies
Relevance 66.42%

Hi
I need help writing a macro that takes an Excel file to email.

The Excel file is a data base, I wanted the Macro to take the email from a column of the Excel file, and send out the email to all the emails in the database, if possible also adding a column of the Excel file to address the specific person.

thank you.
 

Answer:need help writing a macro that takes Excel file to email

Can you post a sample file? Please remove any sensitive data.

Rollin
 

2 more replies
Relevance 66.42%

Hy guys

2nd time i am posting stuff for help, and as i was helped before i will again look forward the response.

I have a file of excel, in which i am sending emails to different candidates of admission, with scan letter placed in the same folder by name.

I want to edit this code, which could select attachment based on Column A list adjacent to the email address

I am attaching the file also pasting the code

Sub Test1()
'For Tips see: http://www.rondebruin.nl/win/winmail/Outlook/tips.htm
'Working in Office 2000-2013
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim SigString As String
Dim Signature As String
Dim cell As Range

Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")

On Error GoTo cleanup
For Each cell In Columns("B").Cells.SpecialCells(xlCellTypeConstants)
If cell.Value Like "?*@?*.?*" And _
LCase(Cells(cell.Row, "C").Value) = "yes" Then

Set OutMail = OutApp.CreateItem(0)

strbody = "We at Graduate School of Engineering Sciences and Information Technology are extremely pleased to know that you have selected Hamdard University as preferred choice for your graduate/post-graduate Studies. " & vbNewLine & vbNewLine & _
"Hamdard University is a pioneer Higher Education Institute (HEI) of Karachi producing Masters and PhDs in the fields of Engineering, Computer Sciences, Information Technology, Energy and Environment since 19... Read more

Answer:Attachment based on cell value in a excel email macro

anybody ???
 

2 more replies
Relevance 66.42%

I found this code in this forum.
i want to add recipient as CC or BCC. What is the correct code for that?
Thanks in advance!

Code:
Public Sub email()

Dim SubJ, Recip As String

SubJ = "Enter your suject"
Recip = "[email protected]"


ThisWorkbook.SendMail Recip, SubJ

msgbox "Email Sent"

End Sub

 

Answer:Send excel sheet ( email) through macro with recipient and cc

6 more replies
Relevance 66.42%

Hello,

My first post, sorry to be a leech right off!

I'm trying to automate some of my day to day emails. I'd like to get a macro set up that will send an email from Excel and paste the range I select in to the body of the email. Would be great if it would send to a list of addresses listed on the page as well.

Using the attached example, I'd like the macro to take whatever range I highlight on the table, copy it to the body of an email and send it to the group of emails listed on the right side.

I'm learning excel, this would help me a lot! I'll be editing this to fit a variety of other tasks. I hope it can be flexible. Thanks in advance.

Chris
 

Answer:Macro: Email Range/Selection to group from Excel

http://www.rondebruin.nl/mail/folder3/mail4.htm

I have done the looping attached.
 

2 more replies
Relevance 66.01%

I have data in excel like this:

1
aaa
bbb
ccc
ccc
ccc
2
aaa
aaa
ccc
3
aaa
bbb
bbb
....

that I need to repeatedly make into a specific landscape format like this:

1 aaa bbb ccc
..............ccc
..............ccc
2 aaa ccc
...aaa
3 aaa bbb
........bbb
---------(PERIODS ONLY FOR ALLIGNMENT PURPOSES)---------------------

Any ideas how to start this. I use VB frequently, but the multiple rows (like in series 1 of several "ccc") are confusing me. Any tips would be appreciated!! Thanks,

Wino
 

Answer:Automate Report -- Macro Question

8 more replies
Relevance 66.01%

Microsoft Access - with a macro named as "autoexec" we can automatically save a report in the pc.Per the Access's menu - have converted the macro to visual basic.Have tried to automate the converted macro so as to automatically save a report but not successful. Is it possible?, If possible wonder whats are the steps?Thanks.

Answer:Access - possible to automate converted macro?

I think your message is confusing, but maybe that's because I haven't used macros in Access.  I believe all Office macros are recorded in a Visual Basic file.  So, what do you mean by "converted the macro to visual basic"?  In your first sentence, you said, "we can automatically save a report in the pc."   But, then you did this "conversion" and then you could not automatically save a report in the pc.  Sure seems like a contradiction.  And, based on what you've said, why do the "conversion" if it causes the "automatically save a report in the pc" to not work?

2 more replies
Relevance 66.01%

Hello,

I have a list of email addresses that have either:
[email protected]
[email protected]
[email protected]
or no corelation to [email protected]

I'm looking for a macro that will take the emails with dots in them and put the first and last names into cells next to the email. The others I can do by hand. PLEASE HELP!
 

Answer:Solved: Excel Macro to convert email addresses to names

16 more replies
Relevance 66.01%

I found how to send an email from an Excel Macro (http://forums.techguy.org/business-applications/1056070-solved-excel-email-outlook-code.html)

Here is the code I'm using:
Code:

Sub Email_Test()
'
' Macro11 Macro
' Keyboard Shortcut: Ctrl+r
Dim eSubject As String
Dim Sendto As String
Dim CCto As String
Dim Body As String
Dim app As Object
Dim Itm As Variant
Set app = CreateObject("Outlook.Application")
Set Itm = app.CreateItem(0)
'Populate variables

mSubject = "Excel EMail Test"
Sendto = "[EMAIL="[email protected]"][email protected][/EMAIL]"
CCto = ""
mMessage = "You have received Knowledge Document Feedback for your domain."

With Itm
.Subject = mSubject
.To = Sendto
If Not IsMissing(CCto) Then .CC = CCto
.Body = mMessage
' .Attachments.Add (NewFileName1) ' Must be complete path
.Display ' This property is used when you want
' .send
End With
Set app = Nothing
Set Itm = Nothing
End Sub
Is there a way to format the message section with bullets? How about paragraph breaks?

Name: John Doe

Date: 6/15/2012
Doc #: KM123456
Etc:
Etc:
Comments:
I'm perfictly willing to look at how-to documentation if someone can point me in the right direction.

Thanks
firstshot
 

Answer:Solved: Formatting Excel Macro Email Message Section

Hi, I haven't really looked myself but instead of bullets I generally use a dash and a tab
Paragraph as such are not possible but you have the linefeed and carriage return

example to add to your macro code before calling the mail proc
Code:

Dim mytext as string
mytext = vbnullstring
mytext = "Dear Jon Doe" & vbclrf & vbcrlf
mytext=mytext & "-" & chr(9) & "Date :" & the date variable & vbcrlf
mytext=mytext & "-" & chr(9) & "Doc #:" & the dos variable & vbcrlf
mytext = mytext & "-" & chr(9) & "Etc :" "etcetera"
mytext = mytext & vbcrlf & vbcrlf
mytext = mytext & "Sincerely yours," & vbcrlf & vbcrlf
mytext = mytext & "Jane Doe" & vbcrlf

vbcrlf can also be replaced wij Chr(10) or Chr(13)

See it this helps.

Maybe html formattingis possible but this works just as fine.
 

3 more replies
Relevance 65.19%

Hi all

Looking for some help! Working on an excel document which contains a button I need to send to multiple people, that's fine what I need is for the subject field of the email to take the contents of a particular cell in the workbook and display that. My current code is;
Code:
Sub SendThis_ActiveWorkbook()

Dim Recip()
With ActiveWorkbook

ReDim Preserve Recip(0)
Recip(0) = "[EMAIL="[email protected]"][email protected][/EMAIL]"
ReDim Preserve Recip(1)
Recip(1) = "[EMAIL="[email protected]"]example[/EMAIL][EMAIL="[email protected]"][email protected][/EMAIL]"
.SendMail Recipients:=Recip, _
Subject:="Vacancy Authorisation " & Format(Date, "dd/mmm/yy")
End With

End Sub
Basically I want the subject to be "Vacancy Authorisation [cell contents] 01/01/2000" so I want the contents of a cell to appear in between the date and the "vacancy authorisation" part of the subject line. Assistance appreciated!
 

Answer:Solved: Excel email macro auto-populate subject line

Subject:="Vacancy Authorization " & Range("A1").Value & " " & Format(Date, "dd/mmm/yy")

Regards,
Rollin
 

2 more replies
Relevance 65.19%

Hi all,

I need to know if is it possible that a macro in Excel sends an email containing the visible cells using Microsoft Outlook.
btw, I saw some code on the internet, that saves the visible cells in a new excel file and attach it in a new email using Microsoft Outlook, but I don't want to have attachments in the email.

thanks for any possible help.
 

More replies
Relevance 65.19%

Although decently experience with excel, I am quite new with VBA and I cannot "record" this macro, so any help writing this in VBA is much appreciated.

1) I need to create a macro that will take a number that is entered into a cell, and upon hitting a button in the excel sheet create an email where the subject line is the number that was in that original cell.

1b)I would like to do this without changing the name of the excel file though, or at least have another macro that resets the file to its original name.

2) Also, if possible, the same macro/vba as above, only with two cells, a number in one and a name in the other, which then shows up as "Number-Name" as the subject line in the email.

Thanks to anyone that can help - Mike
 

Answer:Excel Macro -> email created with field data as subject line

8 more replies
Relevance 59.45%

Got a tricky one here.

My employer has recently installed 5 payment kiosks. The kiosks generate csv files on a daily basis detailing the receipts. This has been running for about three months. NOW my employer wants some stats!

The machines spit out a page of html with links to the relevant csv files. However its only one specific type of file, i.e. dailyxxx.csv where xxx represents a numeric code. There are other csv files but these are to be ignored.

The very hard way, open up the html page, manually click on each dailyxxx.csv and paste the results into Excel, repeat for a lot of links.

The easy way, can excel be fed, the html page and automatically import the csv files of interest? They will always have the same prefix, daily, and the same file format .csv.

The awkward bit, any help would require to be without my being able to supply a sample – due to the confidential nature of the financial information.

But it will always be a page of html links, and they, as stated, will always follow the same naming prefix and always be csv files.

I will be much impressed if this is something that can be automated with, for example vba or similar. I will not take any credit for any assistance provided.
 

Answer:Automate excel importing

16 more replies
Relevance 59.45%

I need to automate courier rate using two sheets with different rates.two sheets are HEAVIES and NON HEAVIES RATES.each sheet will have the corresponding weight as rows and Country Zones as columns.i also have a separate sheet for the proper zoning of countriesi want to create a main page/excel wherein if I type in the weight with the corresponding country it will show me the correspinding rate.please help me

Answer:Automate price using excel

It sounds like VLOOKUP will work, but until we know a little more about your data, there is not much we can offer.Please click on the following line, read the instructions found via that link and then post an example of your data.Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.

2 more replies
Relevance 59.45%

I apologize if this has been asked and answered before. I have searched and could not find an answer specific to the situation I am facing.

I am needing to create automatic email reminders based on due dates. The issue is there are several milestones for each project referring back to one person. I need a method to send emails (through Outlook) automatically when the due date is approaching (within 3 days).

I have attached a sample sheet for reference.

Thanks.
 

Answer:Automate Emails from Excel

8 more replies
Relevance 59.45%

Hi,Can someone please help me with my monthly report? I need to have the new monthly data automatically update and have the previous month archive. At the moment my data sheet is operating by =IF(month=current month,vlookup(data)). As a result I have to manually cut and value paste the previous month data before starting the new month. which some time I forgot to do (and it throw out my YTD cummulative data).thank you so much in advance

Answer:How to get excel to automate data

There's no way we can answer your question without more information.We don't know what the data looks like, how it is laid out, calculated, etc.Post some examples (after reading the How To reference below) and we'll see what we can do. Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.

3 more replies
Relevance 59.04%

I am using the MSN Stock Quote addin with MS Excel 2003. Prior knowledge of this should not be necessary, but I just thought I'd provide full context to my issue. I wrote a macro that essentially records daily stock prices. Because I don't want to store old quotes into perpetuity, i need to ensure that the update quotes button has been hit. I use sendkey() to accomplish this, and then the macro copies the quotes and pastes them elsewhere. My main goal is to have the task scheduler open this file daily so i dont ever have to think about this again, and i'm so close. Essentially my problem is that it takes a few seconds after the update button is hit for the add-in to fetch the new prices from the internet, and this process appears to be delayed until the macro is finished. This is a problem because the macro ends up recording un-updated quotes. I have tried the Application.Wait procedure, and I've tried time consuming loops, do while loops, etc. All of these approaches result in the same thing: Can someone please help me with this? I'm too lazy to hand update this spreadsheet every trading day for the rest of my life (or until i quit). Thank you in advance!
 

Answer:Excel Macro - Allow cells to update query before macro completes

Can't you just put the update macro code in a module of it's own and call it from the main macro?

Regards,
Rollin
 

1 more replies
Relevance 58.63%

A real estate agent I know wants to setup a bulk email process for her network of clients. She is looking for a tool which can email to several hundred recipients at once and can automatically send these notes at regularly scheduled times, (ie: weekly, monthly, etc).

Does anyone know of a product or products she might consider to do this for her?
 

Answer:Need to automate bulk email

8 more replies
Relevance 58.63%

Hi,

I am looking to create something that will auto setup email accounts in outlook express, 2000,2003,2007 like the old .ins files but where user input is only need to insert email address and password
 

More replies
Relevance 58.63%

Hi everyone,

I currently have a server setup with 1 desktop and 2 laptops connected to it. The server stores all of our media etc on it.

What I would like to do is have it setup so that when a user downloads a file to the server the user name and file name are extracted and when the download completes the user who requested it is sent an email.

in steps its

1. file moved to folderA user name and file name recorded

2. file moved to processing folder and downloaded

3. file moved to completed folder and user emailed file name and short message
I think steps 1 and 2 could be completed with a batch im just unsure how to do it and as for step 3 i think i would need some sort of watcher or something?

any help would be great! cheers!
 

Answer:Automate downloads and email

Posted via Mobile Device
Don't think you can do this natively. You would need 3rd party software to accomplish this.
 

3 more replies
Relevance 58.63%

On one worksheet I have 4 rows of exactly the same data with one column only containing a new data. E.g.:A100 A 1A100 A 2A100 A 3A100 A 4I want to keep only one row of the data and have column C data listed with semicolonsA100 A 1;2;3;4Do you know if there is a way to automate this task?

Answer:Automate Repetitive Excel Task

You did not include Row or Column labels so I am going to assume that your data is in A1:C4.If that is the case, then try this:=A1 & " " & B1 & " " & C1 & ";" & C2 & ";" & C3 & ";" & C4 Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.

2 more replies
Relevance 58.63%

Hi All,
I have been automating IE 7 with excel 2007 VBA in XP for a couple of years and have hit a stumbling block. I need to click on a text box to move a secured site forward in the process to edit a record. The text field that is NOT active NOR is it a hyperlink, but has an unnamed onClick event. As this is a secure site, the URL path never changes.

Attached is the Source Code with alias names/values for the text I need to click,
and my vba to get to this point:

How can I click this item with vba code?
 

Answer:Automate IE with Excel onClick text

Figured it out!

I was trying to click on a row of a table. This row had no name, but did have a Class and Title with an onClick="postURL...."
So what you need to do is loop through all items on the page until you find the class that equals the name. in my case, <tr class="shadedRow"

First you need to identify what element to loop through:

Dim inputElements As Object
Dim inputElement As IHTMLElement
Set inputElements = appIE.Document.getElementsByTagName("TR")

I selected "TR" above because <tr class="shadedRow". if you wanted to search through tables <table, then just type "table" instead of "TR".

For Each inputElement In inputElements
If inputElement.className = "shadedRow" Then
inputElement.Click
GoTo A
End If
Next inputElement

again, if you're searching for a tablename, change the if statement in the code above to tableName = "yourtablename"

Hope this helps someone other than me.
 

5 more replies
Relevance 58.22%

I want to place a button in an excel spreadsheet which when pressed performs the refresh data action, rather than use right click.The only way I know is to record the refresh data action in a macro and assign it to the button. Is there a way of assigning one action to a button without using the macro recorder?

Answer:How to automate refresh data action in excel

I just did the macro and it took a few seconds, so I've really answered my own question.

1 more replies
Relevance 58.22%

I have list of suppliers in excel (column A)I need to copy each cell (A1,a2,a3?)select supplier from drop down in a web page (list will be from Excel)Where there are multiple links by clicking on it, it would open an invoiceTake the screen print for particular regionSave it in the local drive

Answer:In Excel how do you Automate web tasks to take screen prints

Not sure about others, but it would help if you could include some screenshots of what you're talking about. Because it sounds like you're trying to collect data from multiple places and take a snapshot of it, yes? 20 years in IT and counting, baby\m/ > < \m/

3 more replies
Relevance 58.22%

Background:
We have a weekly meeting that we all sit around and dish out our schedules and manually input them into a master excel sheet. This is inconvenient, time consuming, and inefficient. We would like to automate the process.

What we need:
Outlook Calendars (7 in total) -> Master Excel Sheet -> Member Schedule Excel Sheet

Outlook needs:
1) We need all 7 outlook calendars to go into one single excel sheet. We want it to happen on a weekly basis on Fridays.

2) The excel sheet needs to have variables for the owner, category, subject, start date, end date, attendees.

a. This is already in the code below

3) The code below needs to be edited to where it is automatic and not manual. At the moment we have to manually select the dates that the code draws from on the calendar. We want it to be an automated process to take place every Friday evening.

4) Also, we have a system of classification in place to say if the file is confidential or not. This has caused problems with the code when trying to save since it cannot tell the program what to do. This is a minor problem that we could probably work around, but would be nice to have it automated as well.

Master excel sheet needs:
1) The 7 calendars need to be imported into this one sheet

2) The variables mentioned above should be the columns

3) The code below does this well, but as mentioned, we need it to be automated

Member Schedule Excel Sheet:
1) This excel sheet has a list of the members with dates by day and m... Read more

More replies
Relevance 57.4%

New to the forum, and hoping that there already exists a solution to my problem, or that the community gurus can help...

I was tasked at work with creating several new pages (multiple files) of Visio schematics. I have an Excel spreadsheet that lists the major components as a sort of Bill Of Materials. Each major component has a Reference Designator (i.e. "2A7") associated with it.

I would like a way to automatically search through all of the Visio files to determine on which file(s) each Reference Designator appears. I can do the job manually by simply typing "2A7 " into the Windows Explorer Search window. But, obviously, this takes a lot of time, is prone to me transcribing something wrong, and requires me to re-do a search any time something changes, either on the drawing files or the BOM.

I've asked the same question on an Excel forum, and there's apparently some limitation that VBA has with accessing Visio's .vsd files.

More replies
Relevance 56.99%

I manage a small database of paid memberships for a non profit. We are keeping up with membership dues and renewal dates in an excel spreadsheet. I would like to automatically generate an email through outlook 30 days before the renewal date, again 14 days before the renewal data (if they haven't renewed), again 5 days before renewal date (if they haven't renewed), and again 5 days after it has expired. Furthermore, I would like to customize the message of the emails if possible, including my signature that is saved in outlook.

In my limited knowledge of VBA/Macros, I would assume that I will need a column that is checked if a membership has been renewed, so that the macro will know whether to generate an email. Also, I am assuming that this would be easier if I had multiple macros instead of just one.

I am attaching a excel sheet that has the columns we will be using with dummy data.

Thank you.
 

Answer:Automate Renewal Emails To Members Based Off Excel Dates

11 more replies
Relevance 55.76%

Speed up Outlook email chores: 5 ways to automate repetitive tasks
Anything that speeds up email communication in Microsoft Outlook has to be a bonus.
Typing and retyping the same paragraphs, the same information, explanations, directions, instructions,
and so on is half the problem, one that can be easily solved with these five, easy, time-saving tips.
Full story: http://www.pcworld.com/article/2902903/ ... tasks.html

More replies
Relevance 55.35%

Hi, I'm new to this forum (actually forums in general) I was wondering if anyone could help me with a macro code. I work with 4 Excel sheets for my shippments, 2 sets for one plant and 2 for the other but all within the same file.

What I am trying to do is set up a macro that will automatically search for changes within sheet 1 (also for sheet 3, the other plant) When I change the rows color from blank to green/red, I need the macro to automatically cut that whole row and paste it into sheet 2 on the next blank row.

This doesn't seem like it would be that hard to do, but I know know the whole macro language.

If you can answer this please send me an email to soulblazor(@)hotmail.com

Thank you for your help.

More replies
Relevance 54.94%

Hi,

I was wondering if anyone could help me. I need to extract data from multiple excel files into a new excel file and sum the values. The data comes from excel files that are made from a template so the data is always in the same place or same cells. For example, i have data saved daily in excel files with the following naming convention 080204, 080304, 080404,..... and so on. What i would like to do is have a macro that will create a week ending sheet by importing and summing the data from that week.

Thanks for reading!
 

Answer:excel macro for copying and pasting data from multiple excel files

thanks for all those who read!!!! let me know if anyone needs the code!
 

1 more replies
Relevance 54.94%

Hello again,

I have a word doc that has a form in it. The form may have any number of fields (boxes) to type text answers into, or be a drop down list to select an answer from. I need an excel macro that extracts all data from the form, but with every five fields starting a new row in excel. So all data from the form will appear within 5 columns in an excel spreadsheet.

field 1 field 2 field 3 field 4 field 5
field 6 field 7 field 8 field 9 field 10
etc

Is that possible? I have had no luck to do it myself.

Sample form attached, thank you
____________________________
 

Answer:Solved: Excel macro to extract Word form data into Excel

7 more replies
Relevance 54.94%

I am trying to create a code that will autofilter data on an Excel worksheet. The code works fine to filter the data, but it does not hide the AutoFilter Arrows.

Below is the code I am using. What (if anything) is wrong with the code below?
Code:

ActiveSheet.Range("A1:D500").AutoFilter Field:=2, Criteria1:="<>", Visibledropdown:=False
 

Answer:Solved: Excel 2007 Macro -> Hide Excel AutoFilter Arrows

I noticed that the code above (in Post #1) that the AutoFilter Arrows were beinf truned off on Field 2, but none of the others.

I have played around, and done some research to come up with the code below:
Code:

Dim c As Range

For Each c In ActiveSheet.Range("A1:D1")
ActiveSheet.Range("A1:D500").AutoFilter Field:=2, Criteria1:="<>"
c.AutoFilter Field:=c.Column, Visibledropdown:=False
Next

Does anyone have a better solution?
 

1 more replies
Relevance 54.94%

I’m using Windows 7 and I used a macro which worked totally fine under Excel 2003. Now, under Excel 2007 it does not run anymore but displays the following error message:

"Run-time error '445':
Object doesn't support this action.

The function of the macro is to open up all other Excel spreadsheets located in the same folder and copy data out of them into the spreadsheet in which the macro is stored.

When I click on "Debug" the Visual Basic Editor highlights the row which says: Set FilSrch = Application.FileSearch

Can you help me with this? I've searched for a solution for a long time but could not find anything which worked.

The following is the start of the macro code:

Sub UpdateTable()
Dim X As Range, I As Integer, J As Integer, RecNo As Integer, CopyVal As Variant
Dim SourceBk As Worksheet, DestBk As Worksheet, StartRow As Integer, IndRange As Range
Dim ServRange As Range, SrcOpen As Boolean, SourceName As String
Dim FilSrch As Object, MyFilArray() As String

'MsgBox "This function not available in this version.", vbInformation, "Function Not Available"
'Exit Sub
'Sheets("LookUp").[a12] = Now
With Application
.ScreenUpdating = False
.StatusBar = "Counting source files ..."
End With
Set FilSrch = Application.FileSearch
With FilSrch
.NewSearch
.LookIn = ActiveWorkbook.Path
.FileType = msoFileTypeExcelWorkbooks
If .Execute > 0 Then
ReDim MyFilArray(.FoundFiles.Count)
For I = 1 ... Read more

Answer:Solved: Excel 2003 Macro Doesn't Run in Excel 2007 - Help Requested

7 more replies
Relevance 54.94%

Hello,

I need help to create an Excel macro that would

1. ask users to select x number of rows to be copied from one worksheet of one Excel file
2. once users have selected the rows to be copied, then the rows are copied from the one original Excel file into X number of target Excel files

Notes:
the target Excel files are all based on the same template
there is one worksheet in each of the target Excel files

in the target files, the rows should be copied from the first available empty row, going down

Looking forward to your help!

Thanks a lot.
Mzz
 

Answer:Macro needed to copy x number of rows from one Excel file into a batch of Excel files

Hi, welcome to the board.
Not much info there to get the correct picture.
Sample? Of source and template please
And not to forget, what version of Excel are you and the users using?
 

1 more replies
Relevance 54.53%

Hi,
I want to merge two excel files into a 3rd one.

The data are in the files Book1, Book2 and the result in Book3.

I know that i can use VLookup to do the above. But what i have pasted is just an example. The real excel files contains about 9 columns with at many repeating row!!!

Any help will be much appreciated.
Thx
 

Answer:Excel - macro to merge 2 excel files using a common column

Hi welcome to the board. How are you going to treat the duble items, If you want to merge 2 files adn duplication occurs here must be one cell whihc is common to let's say Book1 and Book2.

Do you have a common value? Index? Whatever you call it?
 

3 more replies
Relevance 54.53%

I'm working on a Bill of Material creation automation project that requires some expertise in VBA, and I have none.
The objective is to run a macro from an excel spreadsheet called "PGE BOM", to do the following:
1) Go to the folder "C:\Documents and Settings\Desktop\Auto Project"
2) Find all the .mdb databases in this folder
3) Find "HistoricalMaterialItemsAll" table in EACH of those databases in step 2, and import the data from the columns listed below into PGE BOM.xls's columns C through G:
DrawingNumber
ItemNumber
Quantity
PgeCode
Description
The following is a VBA code that my friend had written in Excel 2007. Unfortunately I have an older version (2000) and the code does not seem to be compatible with Excel 2000.
Sub ImportAccessData()
Stop
dPath = "C:\Documents and Settings\Desktop\Auto Project\"
sFile = "*.MDB"
strSrch = dPath & sFile
Set TargetWB = Application.ActiveWorkbook
Set TargetWS = TargetWB.ActiveSheet
sRow = 2
bFile = False
If Dir(strSrch) <> "" Then
strFlNm = Dir(strSrch)
bFile = True
End If
Do Until bFile = False
strPath = dPath & strFlNm
Call GetData(strPath)
strFlNm = Dir
If strFlNm = "" Then bFile = False
Loop
End Sub
Sub GetData(fl)
Stop
strSQL = "Select HistoricalMaterialItemsAll.* From HistoricalMaterialItemsAll"
Workbooks.OpenDatabase fl, strSQL, xlCmdTable
Set WB = Application.ActiveWorkbook
Set WS = Applicatio... Read more

Answer:Excel Macro - VBA code to import access data to excel

Hello, and welcome to the board!

When posting code, please use CODE tags, which extremely helps with readability.

Perhaps you could try using the code constant???...
Code:

Option Explicit

Sub ImportAccessData()
Dim dPath As String, sFile As String, strSrch As String
Dim TargetWB As Workbook, TargetWS As Worksheet
Dim sRow As Long, bFile As Boolean, strFlNm As String, strPath As String
dPath = "C:\Documents and Settings\Desktop\Auto Project\"
sFile = "*.MDB"
strSrch = dPath & sFile
sRow = 2
bFile = False
Set TargetWB = Application.ActiveWorkbook
Set TargetWS = TargetWB.ActiveSheet
If Dir(strSrch) <> "" Then
strFlNm = Dir(strSrch)
bFile = True
End If
Do Until bFile = False
strPath = dPath & strFlNm
Call GetData(strPath, TargetWB, TargetWS)
strFlNm = Dir()
If strFlNm = "" Then bFile = False
Loop
End Sub

Sub GetData(fl As String, WB As Workbook, ws As Worksheet)
Dim strSQL As String, iRow As Long, sRow As Long
strSQL = "SELECT HistoricalMaterialItemsAll.* FROM HistoricalMaterialItemsAll"
Workbooks.OpenDatabase fl, strSQL, 3 'xlCmdTable
iRow = 2
Do Until ws.Cells(iRow, 1) = ""
ws.Cells(sRow, 7) = ws.Cells(iRow, 5) 'Get the Description
iRow = iRow + 1
sRow = sRow + 1
Loop
Application.DisplayAlerts = False
WB.... Read more

1 more replies
Relevance 54.12%

I used a macro which worked totally fine under Excel 2003. Now, under Excel 2007 it does not run anymore but displays the following error message:"Run-time error '445':Object doesn't support this action.The function of the macro is to open up all other Excel spreadsheets located in the same folder and copy data out of them into the spreadsheet in which the macro is stored.When I click on "Debug" the Visual Basic Editor highlights the row which says: Set FilSrch = Application.FileSearchCan you help me with this? I've searched for a solution for a long time but could not find anything which worked.The following is the start of the macro code:Sub UpdateTable()Dim X As Range, I As Integer, J As Integer, RecNo As Integer, CopyVal As VariantDim SourceBk As Worksheet, DestBk As Worksheet, StartRow As Integer, IndRange As RangeDim ServRange As Range, SrcOpen As Boolean, SourceName As StringDim FilSrch As Object, MyFilArray() As String'MsgBox "This function not available in this version.", vbInformation, "Function Not Available"'Exit Sub'Sheets("LookUp").[a12] = NowWith Application .ScreenUpdating = False .StatusBar = "Counting source files ..."End WithSet FilSrch = Application.FileSearchWith FilSrch .NewSearch .LookIn = ActiveWorkbook.Path .FileType = msoFileTypeExcelWorkbooks If .Execute > 0 Then ReDim MyFilArray(.FoundFiles.Count) For I = 1 To .FoundFiles.Count If .FoundFiles(I) <> ActiveWorkbook.Path & "\" & ActiveWorkbook.Name Then ... Read more

Answer:Excel 2003 Macro doesn't run under Excel 2007

As far as I know, Application.FileSearch is not available in 2007. Searching for filesearch replacement turns up lots of hits with various workarounds, such as this:http://groups.google.com/group/micr...Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.

2 more replies
Relevance 54.12%

Hi, I have created an excel macro that runs sensitivities in my model. The excel button runs 5 different cases.

The macro runs fine and does as I want it to.

Once the macro has run, and I go to edit a cell and hit "F2" excel crashes. This only seems to happen in certain cells and not all of the time.

Does anyone have experience with similar questions?

Thanks
 

Answer:Excel Macro runs fine..then excel crashes

11 more replies
Relevance 54.12%

Does anyone know how to run Excel 2003 print macro on Excel 2007 or higher? When I tried running my 2003 macro, the VBA editor pops up w dialogue box, " Run-time error '1004': Method 'ActivePrinter' of object'_Application' failed ".

This is my code: Application.ActivePrinter = "Epson LQ-300 ESC/P 2 on USB003"

Can anyone help?

Thanks!
 

Answer:How to run Excel 2003 print macro on Excel 2007?

Welcome to TSG hope we can help you and you can help others.

I'm not an Excel macro guy but you code looks reasonable. What happens if you run this. I suspect printer name is a little off.

MsgBox "The name of the active printer is " & Application.ActivePrinter
 

1 more replies
Relevance 54.12%

Hi guys,

I have been on the lookout for a macro that will compare 2 worksheets within MS Excel and output the differences on a third sheet.

I am being directed to the URL below but cannot for the life of me work out how to implement this:

http://exceltip.com/st/Compare_two_worksheets_using_VBA_in_Microsoft_Excel/477.html

There are two snippets of code which I will include here for convenience but not sure whether these should be pasted into Workbook Code (i.e. right-clicking Excel icon left of "File" - top-left), Worksheet Code (i.e. right-clicking worksheet tab) or inserting a new Module - or some other method. Is there anyone here that could guide me to how to implement this code?

Quote from webpage - "With the macro below it is possible to compare the content of two worksheets.
The result is displayed in a new workbook listing all cell differences. "

Code:
Sub CompareWorksheets(ws1 As Worksheet, ws2 As Worksheet)
Dim r As Long, c As Integer
Dim lr1 As Long, lr2 As Long, lc1 As Integer, lc2 As Integer
Dim maxR As Long, maxC As Integer, cf1 As String, cf2 As String
Dim rptWB As Workbook, DiffCount As Long
Application.ScreenUpdating = False
Application.StatusBar = "Creating the report..."
Set rptWB = Workbooks.Add
Application.DisplayAlerts = False
While Worksheets.Count > 1
Worksheets(2).Delete
Wend
Application.DisplayAlerts = True
With ws1.UsedRange
lr1 = .Rows.Count
lc1 = .Column... Read more

Answer:Solved: How to use this Macro in MS Excel (compare excel worksheets)

Apologies... I have sorted this... For those that might be looking at this for help here's what I missed:

These are both Sub's that should be created as a Module - both in the same module. I am just comparing worksheets within the Active Worksheet so just removed:

' compare two different worksheets in two different workbooks
CompareWorksheets ActiveWorkbook.Worksheets("Sheet1"), _
Workbooks("WorkBookName.xls").Worksheets("Sheet2")
Click to expand...

I was then able to run this from Macro's. All sorted.

Apologies again
 

1 more replies
Relevance 54.12%

I run a weekly excel 2007 macro that converts a spreadsheet to a Word document, but it stops after row 29 of data. Any spreadsheet with 29 rows or less works fine. If I have 34 rows of data, the macro hangs. See below for script. Any help would be appreciated.

Public Sub AddControls(WrdApp As Word.Application, CurRow As Integer)
Dim OptChecked As Boolean
Dim GrpName As String
GrpName = "Grp" & CurRow
'Calculate the colors based on the cell information.
CurRange = "F" & CurRow & ".." & "F" & CurRow
Range(CurRange).Select

If InStr(1, UCase(ActiveCell.Text), "X SRM") > 0 Then 'SRM
OptChecked = True
Else
OptChecked = False
End If

SetCellBG WrdApp, True
WrdApp.Selection.TypeText Text:="Governance:" & vbCrLf

Set RadioObj = WrdApp.Selection.InlineShapes.AddOLEControl("Forms.OptionButton.1")
With RadioObj.OLEFormat.Object
.GroupName = GrpName
.Caption = "SRM"
.Font.Name = "Arial"
.Font.Size = 8
.Value = OptChecked
End With

If InStr(1, UCase(ActiveCell.Text), "X PPO") > 0 Then ' PPO
OptChecked = True
Else
OptChecked = False
End If

WrdApp.Selection.Collapse Direction:=wdCollapseEnd
WrdApp.Selection.TypeParagraph

Set RadioObj = WrdApp.Selection.InlineShapes.AddOLEControl("Forms.OptionButton.1")
With RadioObj.OLEFormat.Object
.GroupName = GrpName
.Caption = "PPO"
.Font.Name = "Arial"
.Font.Size = 8
.Value = O... Read more

Answer:Excel Macro - converting excel to word doc - stops after row 29

13 more replies
Relevance 54.12%

With due respect and credit to DerbyDad03 whose earlier post gave me the code below; is there any way to have the new worksheets created from a variable length field e.g. a persons name in a list or a field of fixed length other than a date as the script below uses?Sub CreateMonthlySheets()Dim lastRow, mMonth, tstDate1, tstDate2, shtName, nxtRowOn Error Resume Next'Turn off ScreenUpdatingApplication.ScreenUpdating = False'Make a copy of the data sheet and sort by date Sheets("Sheet1").Copy After:=Sheets(1) Sheets(2).Name = "SortTemp" With Sheets("SortTemp") lastRow = .Cells(Rows.Count, 1).End(xlUp).Row Rows("2:" & lastRow).Sort Key1:=Range("A2"), Order1:=xlAscending 'Using SortTemp Sheet, create monthly sheets by'testing Month and Year values in Column A'Loop through dates For Each mMonth In .Range("A2:A" & lastRow) tstDate1 = Month(mMonth) & Year(mMonth) tstDate2 = Month(mMonth.Offset(-1, 0)) & Year(mMonth.Offset(-1, 0)) 'If Month and Year are different than cell above, create new sheet If tstDate1 <> tstDate2 Then ActiveWorkbook.Sheets.Add After:=Worksheets(Worksheets.Count) 'Name the sheet based on the Month and Year ActiveSheet.Name = MonthName(Month(mMonth)) & " " & Year(mMonth)'Copy Column Widths and Header Row .Rows(1).Copy ActiveSheet.Rows(1).PasteSpecial Paste:=8 'ColumnWidth ActiveSheet.Rows(1).PasteSpecial 'Data... Read more

Answer:Excel Macro to create new worksheet in Excel 2010

I created a quick macro to help you out. This macro creates a new sheet and names it using the contents of cell "A1".Sub CreateNewSheet()
Dim NewSheet
Dim SheetName As String

SheetName = Worksheets("Sheet1").Cells(1, "A").Value
Set NewSheet = Sheets.Add(After:=Sheets(Worksheets.Count), Count:=1, Type:=xlWorksheet)
NewSheet.Name = SheetName

End Sub
Law if Logical Argument: Anything is possible if you don't know what you're talking about.

4 more replies
Relevance 53.71%

I have a word document that includes a form the user must fill in. I want to create a button that will do all of the following:
1. Update all fields
2. Attach the updated word document to an email
3. Enter an address I have stored in the macro into the To field of the email.

I have one module which does the first part:
Sub CommandButton1_Click()
Dim oStory As Range
For Each oStory In ActiveDocument.StoryRanges
oStory.Fields.Update
If oStory.StoryType <> wdMainTextStory Then
While Not (oStory.NextStoryRange Is Nothing)
Set oStory = oStory.NextStoryRange
oStory.Fields.Update
Wend
End If
Next oStory
Set oStory = Nothing
End Sub

I found that if I add this to the before End Sub it attaches the updated Word document to an email:
Application.Options.SendMailAttach = True 'Or False
ActiveDocument.SendMail

However, I can't figure out how have it put a specific address into the To field of the document.

So I tried another tact. I have the email address as a hyperlink in the document, and set a bookmark at the hyperlink. Then I created a module that will go to the bookmark and open the hyperlink. However, this will not add the document as an attachment:

Sub Open_Hyperlink()
Selection.GoTo What:=wdGoToBookmark, Name:="hyperlink"
With ActiveDocument.Bookmarks
.DefaultSorting = wdSortByName
.ShowHidden = False
End With

Selection.Range.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
End Sub

So then I found this bit of coding on the web, and tried imp... Read more

Answer:Word Macro to attach doc to email, then send address email

I found a solution, but I think it is a bit bulky. It seems to work but I'd love to know if there is a simpler solution:
Sub CommandButton1_Click()
Dim oStory As Range
For Each oStory In ActiveDocument.StoryRanges
oStory.Fields.Update
If oStory.StoryType <> wdMainTextStory Then
While Not (oStory.NextStoryRange Is Nothing)
Set oStory = oStory.NextStoryRange
oStory.Fields.Update
Wend
End If
Next oStory
Set oStory = Nothing

ActiveDocument.Save

MsgBox "Thank you. Your order has been sent", vbOKOnly, "Thank you. Your order has been sent"
Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem
On Error Resume Next
If Len(ActiveDocument.Path) = 0 Then 'Document has not been saved
ActiveDocument.Save 'so save it
End If
Set oOutlookApp = GetObject(, "Outlook.Application")
If Err <> 0 Then 'Outlook isn't running
Set oOutlookApp = CreateObject("Outlook.Application")
bStarted = True
End If

Set oItem = oOutlookApp.CreateItem(olMailItem)
With oItem
.To = "[email protected]"
.Subject = "Promo Order" '
.Body = "Thank you for your order"
.Attachments.Add Source:=ActiveDocument.FullName, Type:=olByValue
.Send
'**********************************

End With
If bStarted Then 'If the macro started Outlook, stop it again.
oOutlookApp.Quit
End If
Set oItem = Nothing
Set oOutlookApp = Nothing
End Sub
 

1 more replies
Relevance 53.71%

Hello, I'm just joined and am trying to create a macro that will automatically email an entire workbook to a list of individuals. I also want the macro to copy and paste a range of cells within a specific sheet in the workbook and paste it into the body of the email. I am able to email the workbook but can't figure out the second part. Any help would be appreciated.

I am using Excell 2007 and LotusNotes 8.5.1
 

Answer:Macro to email centain range in body of email as well as the whole workbook

Hi, welcome to the forum.
There are several posts where I added some simple tips and tricks.
Do you have the macro you use now to mail the whole workbook?
If I see how you have done this then maybe it's a cinch to add the extra info
You may also post a workbook with fictious data if you wish
 

1 more replies
Relevance 53.3%

I have an equation that I need help with putting into an excel Macro. The equation is as follows:
=IF(AND(ISBLANK(E2),ISNA(F2)),"XXXXXX",IF(AND(ISBLANK(E2),ISNUMBER(F2)),"ASSIGN LAN ID",IF(AND(E2="XXXXXX",ISNUMBER(F2)),"ASSIGN LAN ID",IF(AND(E2="XXXXXX",ISNA(F2)),E2,IF(AND(OR(ISBLANK(E2)="FALSE",E2<>"000000",E2<>"111111",E2<>"999999",E2<>"IOIOIO",E2<>"XXXXXX"),OR(ISNUMBER(F2),ISNA(F2))),E2,"No Criteria Met")))))

I need this put into a macro as either an if then else statement or a case statement. If anyone could help me out i would appreciate it
 

Answer:Excel Equation converted to an excel macro

Not sure if this will work for you or not, untested...
Code:
dim e as range, f as range, c as range
set e = range("E2"): set f = range("F2"): set c = activecell
if e = "" and worksheetfunction.isna(f) then
c.value = "XXXXXX"
elseif e = "" and isnumeric(f.value) then
c.value = "AS SIGN LAN ID"
elseif e = "XXXXXX" and isnumeric(f.value) then
c.value = "ASSIGN LAN ID"
elseif e = "XXXXXX" and worksheetfunction.isna(f) then
c.value = e.value
elseif (e <> "" or e <> "0000 00" or e <> "111111" or e <> "999999" or e <> "IOIOIO" or e <> "XXXXXX") and (isnumeric(f) or worksheetfunction.isna(f)) then
c.value = e.value
else
c.value = "No Criteria Met"
end if
HTH
 

3 more replies
Relevance 53.3%

A macro I wrote in VBA for Excel 2004 won't run in Excel 2011 (alas...). Upon opening the spreadsheet an "on open" routine runs, and bombs out on the following command:
Code:
Set cmdbar = Application.CommandBars.Add _
(Name:="Sort", _
Position:=msoBarTop, _
MenuBar:=False, _
temporary:=True) 'msobartop docks the menu at the top

Does anyone know if the VBA structure ("CommandBars.Add") has been removed or altered?

Is there another way to accomplish the same thing in 2011? I want to create a custom command bar (I populate it later in the module).
 

More replies
Relevance 53.3%

Does anyone know the best way to setup a Macro in Excel 2007 that will work in Excel 2003 as well?

I have an Excel 2007 workbook that I am using a macro to change the "Fill Color" and "Font Color" of cells. However, I will get everything working in Excel 2007, but when I open the workook in Excel 2003 I get many debug errors.

If I change the code in Excel 2003, and then re-open in Excel 2007 I get debug errors.

There must be a way to setup teh workbook to work on both Excel 2007 & 2003.
 

More replies
Relevance 53.3%

Excel '07 won't open an "excel 4.0" macro (i.e. *.xlm file). I am one of a few users at work using excel 2007, I believe this file was made with excel 2000 or similar. When I had excel 2000 it opened fine, it's a common file on the network that everyone should be able to access, and everyone with excel 2000 can easily. So I know it's not the file. When I try and open it with excel 2007 I get that stupid error about the file being different to the extension.

I've tried registry edits and workarounds after scowering the net but nothing seems to fix it. All it does is display the error, then opens excel in the background without even a new worksheet. Excel isn't hanging, it just does nothing. Any ideas?
 

Answer:excel 2007 won't open excel 4.0 macro

XLM was long ago replaced by VBA (with Excel 5 in 1993) and MS no longer really supports it (although I think they claim that they do, kinda, sorta.) So the only thing you can do, I think, is to make a copy of the xlm file and convert the xlm code in the copied file to VBA. Fortunately, I found a link that tells you how to do that:
http://blogs.msdn.com/b/excel/archive/2010/02/16/migrating-excel-4-macros-to-vba.aspx
(Look at the link at the bottom, too. But you will need to download that to an older PC, possibly.)
Now, assuming all goes well, this will give you two versions of the same file, but if everyone else has Excel 2000 (or later) then they will all be able to use the new VBA-based file, so you won't end up with two files that would lead to confusion.
Still, it looks to be a lot of work, so good luck!

On a final note, if you need this file done in VBA and you can't figure out how to redo it, make a post describing your needs - there are some amazing VBA coders on here.
 

1 more replies
Relevance 52.07%

Dear Guyz

I have a macro helped and developed by a respected admin of this group

it has following statement

If Cells(lRow, "N").Value >= 5 And Len(Trim(Cells(lRow, "P").Value)) > 0 Then ' check if the months passed are >= 5 (same as the red conditional formatting)
If Len(Trim(Cells(lRow, "O").Value)) = 0 Or (IsDate(Cells(lRow, "O").Value) = True And Month(Cells(lRow, "O").Value) <> Month(Date)) Then
toList = Cells(lRow, "P") 'gets the recipient's email address Column O

I want to add another line from another macro

If cell.Value Like "?*@?*.?*" And _
LCase(Cells(cell.Row, "C").Value) = "yes" Then

which makes sure that only @ emails are there and also ensures to which person it has to email and which it has avoid.

Can anybody help me to sort out this especially @Keebellah
 

Answer:Yes for Email No for no Email Condition in an if Statement of macro

7 more replies
Relevance 49.2%
Question: EXCEL macro's

OK here is my problem i have i would like to select a range of cells then copy them on to a new sheet. the problem is that the range is different every time due to qty. of items. But the 10 row header before & the symbol " " at the end is consistent.

I would like all the row's between the header and the symbol. any suggestions
 

Answer:EXCEL macro's

Stop posting duplicate threads! You already have posted at least three of these! Stick to one thread and just maybe it'll last long enough to get solved!

Continue here: http://forums.techguy.org/business-applications/532303-excel-usage.html
 

1 more replies
Relevance 49.2%
Question: Excel macro

Hey all,

just made an excel macro and when i run it the worksheet turns blue and the row/column headings turn black and nothing happens. Any suggestions?

thanks
shiva d
 

Answer:Excel macro

8 more replies
Relevance 49.2%
Question: Excel Macro Help

Howdy all. Attached is a mock-up of a workbook I'm trying to assist someone with. It should be a pretty simple macro; we want to take only the negative numbers (in red) in col E and move them to col F; the only caveat is I need the rest of the data in each particular line to stay static.

I will be offline this weekend, but back early AM Monday. The person whom I am assisting may pop in and be able to answer questions over the weekend as well, but that is not confirmed.

Thanks in advance,

v
 

Answer:Excel Macro Help

7 more replies
Relevance 49.2%
Question: excel macro

Hi,
Everyday, I get a file with a list of items and thier prices.How would i create a macro in EXCEL to automatically copy the same data to four regions. This can be anywhere in the sheet and the item and price need to be in the same columns.For example:
item# price
5555 10.00
6666 20.00
7777 30.00
8888 40.00

I would have to do the same with regions 1,2,3,and 4
item# region price
5555 1 10.00
6666 1 20.00
7777 1 30.00
8888 1 40.00
5555 2 10.00
6666 2 20.00
7777 2 30.00
8888 2 40.00
5555 3 10.00
6666 3 20.00
7777 3 30.00
8888 3 40.00
5555 4 10.00
6666 4 20.00
7777 4 30.00
8888 4 40.00
 

Answer:excel macro

6 more replies
Relevance 49.2%
Question: Excel macro

Hi all you excel professionals. I'm still a rookie but I'm slowly getting there. I wonder if the follwing is possible. I'l be very brief. In column A, form cell A1 to A500, I have typed in 0011, 002, 003 , etc up to 00500. In column B, from cell B1 to B500 I have typed the word "total". Now I want to put the word total into Cells A1 to A500. For example, cell A1 would now read 001 Total and cell A2 would now read 002 Total etc all the way to cell A500. I have tried to merge the two cells but I loose the word Total. Is there a macro that will do this? If so can someone out there do it for me?

Please help me.
 

Answer:Excel macro

6 more replies
Relevance 49.2%
Question: Excel macro help

Hi,

I want to open the pdf using the pdf's url link and save it.

for Example:

In Cell A1 = http://amsdc1-s-9729-a2.europe.shell.com/ReportServer?/Shell.SSRS.CSandA.Reports.PrintToPDF/Report&rs:Format=PDF&rs:Command=Render&rc:Toolbar=False&rcarameters=False&FormID=416032&AccountGroup=YSTP&Country=FR &CompanyInformation=1&Credit=1&TaxVat=1&Order=1&Delivery=1&Payment=1&FormSupport=1&ExtendedWorkFlow=1&NameAddress=1&InternationalAddress=1&Classification=1&BusinessPartners=1&Setuponcaps=1&Assesment=1&Response=1&SalesOrder=1&CustomerMaterial=1&ListingExclusion=1&OrderTemplate=1&ShippingReceiving=1&MRN=0
In Cell B1 = The pdf name

How to do this in excel macro. It's very urgent can anyone help me on this....

Pleaseeeeeeeeeeeeeeeeee

Swamy
 

More replies
Relevance 49.2%

I have the following code on a sheet:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
If Target.Cells.Count > 1 Then Exit Sub
On Error GoTo EndMacro
If Not Target.HasFormula Then
Set rng = Target.Dependents
If Not Intersect(Range("A1"), rng) Is Nothing Then
If Range("A1").Value < 4800 Then XXX_Order
End If
End If
EndMacro:
End Sub

Which then spurs the following code:

Sub XXX_Order()
'Working in 2000-2007
Dim OutApp As Object
Dim OutMail As Object
Dim sh As Worksheet
Dim cell As Range, FileCell As Range, rng As Range

With Application
.EnableEvents = False
.ScreenUpdating = False
End With

Set sh = Sheets("List_XXX")

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon

For Each cell In sh.Columns("B").Cells.SpecialCells(xlCellTypeConstants)

'Enter the file names in the C:Z column in each row
Set rng = sh.Cells(cell.Row, 1).Range("C1:Z1")

If cell.Value Like "?*@?*.?*" And _
Application.WorksheetFunction.CountA(rng) > 0 Then
Set OutMail = OutApp.CreateItem(0)

With OutMail
.To = cell.Value
.CC = ""
.Subject = "XXX Stock Replacement Order"
.Body = "Hi " & cell.Offset(0, -1).Value

For Each FileCell In rng.SpecialCells(xlCellTypeConstants)
If Trim(FileCell) <> "" Then
If Dir(FileCell.Value) <> "" Then
.Attachments.Add FileCell.Value
End If
End If
Next FileCell

.Send �... Read more

Answer:Excel macro help please...

10 more replies
Relevance 49.2%
Question: Macro in excel

I would appreciate help with a macro to separate numbers in a line of text within a cell, and also to change the value of that number,
for example remove the text and keep the number or
remove the text and change the number to another value

Mining & Energy Plate-C3
Ryan & McNulty Sawmilling (68)
Black & Black - Bm65

Thank you
 

Answer:Macro in excel

6 more replies
Relevance 49.2%
Question: Excel Macro Help

I have a large data row set to work with, I want to be able to add new data rows every week.

I have been trying to create a macro that allows me to paste my new data rows (either above or below) the existing data.
The main problem I am having is when trying to code/record my macro it automatically pastes it in exact location I click on e.g b4.

I want the pasted data rows to appear either underneath or above the existing data rows, regardless of how many data rows there already are. (as i will be constantly adding new ones, therefore the number of rows in the sheet will rise continuously)

I have tried to use the "Insert Copied Cells" function, but I am finding that my macro does not recognise this...

Any ideas/guidance will be greatly appreciated
 

Answer:Excel Macro Help

Hi there, welcome to the board!

While I'm not sure what you're looking for exactly, you can find the last cell either by looking at the bottom of a column, up, or by using the Find method. The downside of looking at one specific column is if you have uneven columns (usually this doesn't happen, but possible). Here are examples of both...
Code:
Option Explicit

Const NL As String = vbNewLine

Dim WS As Worksheet
Dim rLastCell As Range
Dim iLastRow As Long
Dim iLastCol As Long

Sub FindLastCellColA()

Set WS = ActiveSheet

'/// As a (long) numeric row
iLastRow = WS.Cells(WS.Rows.Count, "A").End(xlUp).Row

'/// As a range object
Set rLastCell = WS.Cells(WS.Rows.Count, "A").End(xlUp)

MsgBox "Column A only" & NL & NL & "Long type: " & WS.Cells(iLastRow, "A").Address(0, 0) & NL & "Range type: " & rLastCell.Address(0, 0)

End Sub

Sub FindLastCellInSheet()

Set WS = ActiveSheet

'/// As a (long) numeric row & column
iLastRow = WS.Cells.Find(What:="*", After:=WS.Cells(1, 1), LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
iLastCol = WS.Cells.Find(What:="*", After:=WS.Cells(1, 1), LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column

MsgBox "Entire sheet&quo... Read more

3 more replies
Relevance 49.2%
Question: Macro VBA Excel

View attachment Example 1.xls
View attachment Example 2.xls
In the worksheet "example 1" macro "sum columns" sum the columns values, but only if the code is numeric. As I do so that it works on worksheet "example 2" whose alphanumeric codes. Attachment both worksheets.

Thank You
 

Answer:Macro VBA Excel

Feliç Nadal

I simplified your code, it's easier to read this way.
 

2 more replies
Relevance 49.2%
Question: Excel Macro Help

Good Afternoon,
I was hoping to get help writing a macro that would look at cell A9 and run function GetCellComment('Master Pricing'!R[-6]C[-8]) and paste that into cell I9.

then loop to the next cell (A10 and paste into cell I10) until it encounters an empty cell in column A.

Thanks in advance for your aid.

/frank
 

Answer:Excel Macro Help

8 more replies
Relevance 49.2%
Question: Excel Macro Help

Good afternoon all

I am putting together a spreadsheet for some colleagues at work to complete each day. Each row is completed for every piece of work they complete (starting at row 6). In column K (cells K6 to K106), a colleague can enter 1 of 5 strings of text (cell has been validated) as follows: -

Car
Van
Motorcycle
Cycle
Other

What I want to do is make excel delete the value/text in the adjecent cell (the one directly to the right, ie L6 when K6 is completed) when the first 4 values above are entered.

For example, if the user puts "Car" in K55, I want all text in cell L55 to be cleared. If the user puts "Other", I want no action taken.

I know that I have to start and end the code with the below, but I am struggling after that. I have tried to define the Range and use the offset function but without success.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
End Sub

Any help would be greatly appreciated.

Mark
 

Answer:Excel Macro Help

9 more replies
Relevance 49.2%
Question: Excel Macro Help

I have started recently to mess around with macros but I can't quite figure out how to do this one.

I have this list of songs with three columns (artist, title and track #) but what i want to do with it is to insert a row between each artist while dropping down the track #. But when the artist is the same i want to add these track numbers.
Attached is what i have and on sheet 2 is what I am trying to figure out if my explanation is not too clear.

Any help would be greatly appreciated
Thanks a lot.
T.
 

Answer:Excel Macro Help

Why not apply a Pivot Table?
I did it in your sample,
The total column is necessary or else it won't show anything but I think this is waht you want?
 

1 more replies
Relevance 49.2%
Question: excel macro help

I am writing a macro that will clean up a lager exported from an accounting program.

I have the following sheet:
Now:
A B C
1 GL Account-8600
2
3 1 / 2011
4 1121
5 1416
6 1416
7 1416
8 1121
9 1121
10 1121
11
12 2 / 2011
13 1416
14 1121
15 1121
16 1416
I would like cell “A3” copied and pasted until they have an empty cell. In this example, it will be A3-A10 will be changed to the number “1”, and cell A13-A16 will have a number 2. (The amount of rows will vary) I will not have a number greater then 12 months. Also, the empty rows (A2, A3, A11 and A12) and the row below needs to be deleted. I will use this data to make a table in excel, ant the macro has been written for that.

I would like the following outcome:
A
1 GL Account-8600
2 1
3 1
4 1
5 1
6 1
7 1
8 1
9 1
10 1
11 2
12 2
13 2
14 2
15 2
16 2
 

Answer:excel macro help

8 more replies
Relevance 49.2%

I'm trying to use an if statement and I can't get Excel to recognize a formula similar to above. I need it to read if this range is greater than value A AND less than value B, then do this. How do I get the if statement to recognize two constraints? Is there a "between" function? I've searched all over the help file and I can't make it work. Please help. Thanks.
 

Answer:Excel Macro - 0 < X < 10

6 more replies
Relevance 49.2%
Question: Excel macro

hi.

I have an excel sheet with many rows and columns. the headings for the columns contain an expiry date, who the agreement is with (hyperlinked to a pdf), type of agreement, time until expiry and type (7 different types). I need a macro that will -
search each row and look for when 'time until expiry' = "less that 2 months" and 'type' = (one of the seven)
then send an email to a person whose email is in a different cell off to one side of the worksheet.

After it has done this, i need to run another macro which checks the same thing but with a different type (and email address)

Once all this is done, i need a macro to do all of the above but with "7 days" as the 'time until expiry'.

I also need a macro to run and search the rows for "unsigned" in the comments and again go through each type and send an email to the respective person.

Can this be done?!?!? It would be great if the macro could run automatically when the workbook is open.

Thanks so much in advance!!!
 

Answer:Excel macro

welcome to TSG, jenrowlands
while this is indeed a "do it yourself" problem, we have a forum much better suited to a business application problem....it's called "business applications

i'm moving your thread there.
 

3 more replies
Relevance 49.2%
Question: Excel Macro

I am fairly new to building macros and have been able to build some fairly simple ones, but I need help with this new one. I have an excel sheet with two columns that goes down several rows with two unique numbers and a separate sheet with two boxes that will create a chart when the two numbers are put into the boxes. I need a macro to grab the two numbers in each row, put them into the two specific cells while moving it to a a new sheet and continue down the rows until a chart has been built for each row. Thanks ahead of time for your help.
 

Answer:Excel Macro

MarinoFan,

I'd like to help with this but I'm confused by your description. How will the macro know which two cells to fill with data on the second sheet? Is there a separate chart for each pair of numbers or is this all one big chart? If they are different ones, is each one on a different sheet?

Cheers.
 

3 more replies
Relevance 49.2%
Question: Excel Macro help

Hi, I've had great success with this form before and was looking for some more help on an Excel spread sheet. I've created a macro that inputs data onto a separate sheet, entered from a template sheet. The macro executes using a button and i was wondering if there was a line of code that could bring the input cell back to the first entry position, after the button in clicked and the inputs are erased. I've attached the input section of my program if anyone would like to look at it. Thanks for any help.
 

Answer:Excel Macro help

After which button is clicked? (you have 3)

Regardless, just add Range("C2").Select at the end of the code.

And while you're at it, replace:

Range("C2:C3:C4:C5:C6:C7:C8").ClearContents

with:

Range("C2:C8").ClearContents

HTH
 

2 more replies
Relevance 49.2%
Question: HELP Excel macro

I have two spreadsheets, one with company name listed in column A and the other with company name (column A) and postcode (column B). I simply want to be able to add the postcode into column B in my first sheet. I cant simply copy them over as there are different number of records.

I guess this is quite a simple matching exercise and if anyone knows a macro to do it I would be mightily grateful.

Tx
 

Answer:HELP Excel macro

I don't think you need macro to do this. Function VLOOKUP should do fine, try it.

Jimmy
 

1 more replies
Relevance 49.2%
Question: excel macro

how to extract multiple excel files contents into one excel files , that all excel files are in one directory with directory reference plz anybody help, i need macro code
 

More replies
Relevance 49.2%

Hi I have been tasked at work with setting up a Vehicle Service reminder spreadsheet for our 8 vehicles,

I would like it to send an email to certain addresses when vehicles reach a certain mileage,

I have the Licence Plates in Column A, Service Interval in Column B (12500, 20000 miles etc), Last Service Mileage in C, Next service mileage in D (last service + service interval), Next service mileage alert in E (NExt service mileage minus 2000 miles), and most recent Mileage in G.

I need a macro that sends an email when the value of G is equal to or greater then E, with the Licence plate in the subject dependant on which vehicle it is, and a short message saying it is nearly due a service,

I have managed to get an email sent, but am stuggling to get the criteria into VBA as i am a complete newbie.

Please help.
 

Answer:VBA/Macro Excel help please

7 more replies
Relevance 49.2%
Question: Excel Macro Help

HiI have 2 problems with an excel macro that I inherited many years ago and it seems a little too complex for my limited knowledge of macros.The first problem is that the macro takes a spreadsheet that has been sorted by column A (in this instance that is Supplier Names)and splits the files at each new supplier name and saves. This gives me circa 60 new individual files. This works perfectly and is easy to use. However, this macro is used at least once per week and the output files all need to be saved. Since the new file names are basically just a reflection of column A data, I manually need to rename the previous weeks files before I can run this. I am looking for a way to differentiate the current weeks files from the previous weeks using the macro. The easist way I can think is to have the date added to the end of the supplier name each week but I can't find a way to add this into the macro. The second problem is that there is an additional file that is supposed to record all the file names to allow the files to be sent via email but the instructions are not clear on how to set this up, where to record the email addresses etc. Any insight in to either of these problems would be very much appreciated.Below is the macro detailsim efile As StringPublic continue As BooleanFunction GetColumn(mColumn) Select Case mColumn Case Is >= 53 GetColumn = "B" & Chr(mColumn + 12) Case Is >= 26 GetColumn = "A" & Chr(mColumn + 38) Case Else GetColumn ... Read more

Answer:Excel Macro Help

7 more replies
Relevance 49.2%
Question: Excel Macro Help

Looking for some help trying to create a macro that could complete the following example (Each row is a row in Excel, and each large spacing is a column):

Going from...
IDxxxxx Region 1xxxxx Region 2xxxxx Region 3xxxxx Channel 1xxxxx Channel 2
1xxxxxxxx Xxxxxxxxxxxxxxx xxxxxxxxxxxxxxXxXxxxxxxxxxxxxxxXxxxxxxxxxxxxxxx X

To this...
IDxxxxx Regionxxxxx Channel
1xxxxxx Region 1xxxxxChannel 1
1xxxxxx Region 1xxxxxChannel 2
1xxxxxx Region 3xxxxxChannel 1
1xxxxxx Region 3xxxxxChannel 2

Any assistance would be greatly appreciated.
Thanks,
 

More replies
Relevance 49.2%

I'm needing to create a macro so that excel auto saves as a PDF given a range of cells (so that it'll only save pg 1 of the document and not the whole sheet). I've got this portion figured out but I also would like a specific cell to be the filename that gets saved. Also, is it possible to have the PDF automatically open after saving? I know you can do that in excel when not using a macro, but is it possible with doing the macro also?This is what I have so far...Sub SaveAsPDF() Dim strFileName As String strFileName = Application.GetSaveAsFilename(FileFilter:="PDF files (*.pdf), *.pdf") If strFileName <> "False" Then Sheets("Sheet1").Range("A1:E50").ExportAsFixedFormat Type:=xlTypePDF, Filename:=strFileName End IfEnd SubI know NOTHING about VBA's or macros and have derived this from many google/youtube searches. Hopefully this isn't too much to ask...

Answer:Macro excel to PDF and more

Try this...
Sub SaveAsPDF()
Dim strFileName As String
Dim myShell As Object
'Use A1 value as filename
strFileName = Range("$A$1")
'Export Range
Sheets("Sheet1").Range("A1:E50").ExportAsFixedFormat _
Type:=xlTypePDF, Filename:=strFileName
'Open PDF
Set myShell = CreateObject("WScript.Shell")
myShell.Run strFileName & ".pdf"
End SubClick Here Before Posting Data or VBA Code ---> How To Post Data or Code.

10 more replies
Relevance 49.2%
Question: Excel Macro Help

Hi all,

I've recorded a macro where I switch from one sheet to another to copy something and then switch back to the previous sheet to continue working, so in the macro it's recorded as:

ActiveWindow.TabRatio = 0.473
Sheets("Template").Select
Range("A1:X31").Select
Selection.Copy
Sheets("Sheet1").Select
ActiveWindow.ScrollColumn = 2

Can anyone help me to edit this so that, rather than selecting "Sheet1" again, it just selects the previous sheet, without needing the name of the sheet to be "sheet1" everytime? This way I will be able to run the macro where I jump to "Template" and return back to whatever sheet I was working in originally, whatever the name is. Make sense?

Hope someone can help!

Thanks!
 

Answer:Excel Macro Help

Do you have at least a little vba knowledge?
You can use variables and assign these to the sheet's names
For eample:
Dim ws1 As worksheet
Dim ws2 As worksheet
set ws1 = sheets("Template")
set ws2 = Sheets("Sheet1")

to select one or the other ...
ws1.select
ws2.select

many time you do not have to change sheets, you can address them anf take the data from one and copy it to another

another example:

ws2.Activate
ws1.range("A1:X31").copy
ws.Range("A2").Pastespecial

Play around with this I can't tell you much more becasue I don't know your sheet's layout etc.

I don't undestand the TabRation and the ScrollColumn=2 can be changed too.
 

3 more replies
Relevance 49.2%
Question: excel macro

does anyone know a macro code line to move to the next row...for instance i am in a4 and i want it to move to a5 then a6

thanks
doug
 

Answer:excel macro

8 more replies
Relevance 49.2%
Question: Excel Macro

I have values entered in the C column that look like the following

'MAK, REP'

I need to find a way to make the values like the following:

'MAK','REP'

Any suggestions would be very much appreciated.
 

Answer:Excel Macro

14 more replies
Relevance 49.2%

I have a report that gives me order numbers, that I then have to provide hyperlinks to the original file. I have limited space on the report, so am converting the full hyperlink into a short name. I also need a # days elapsed and data validation list for each row. I need to be able to do this for each entry in column A as the report can be quite large. Currently I have the macro set up to run after manual entry of the first hyperlink. I then have it copy the hyperlink from the first entry and use the SUBSTITUTE function to update it to correspond with the next entry. All work well. What I don't know how to do is set up the code to create a loop to perform the same action for each row there is data. Think I need a Do Until loop, but am at a loss where to go from here. Here's the code I have so far, it's not pretty but (almost) does the trick:

Manual entry of the first hyperlink, then:

Range("I2").Select
ActiveCell.FormulaR1C1 = "=HYPERLINK(RC[8],RC[-8])"
With Selection.Font
.Name = "Arial"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleSingle
.ColorIndex = 5
End With

And what I want to happen each row after:

Range("Q2").Select
Selection.Copy
Range("Q3").Select
ActiveSheet.Paste
Range("R3").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=SUBSTITUTE(RC[-1],R[-1]C[-17],RC[-17])"
Rang... Read more

Answer:Excel Macro: Do Until?

I didn't read the code but something like this will go thru each row

intRow = 2
Do Until oExcel.Cells(intRow,1).Value = ""
' Execute some code...
intRow = intRow + 1
Loop

Setting 'intRow to 2 gets you past the header.

Do Until oExcel.Cells(intRow,1).Value = ""
is checking the first cell in each row for null.
 

1 more replies