Computer Support Forum

Excel Email Macro

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

Relevance 100%
Preferred Solution: Excel Email Macro

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: 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%

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%

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%
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%

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 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%

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

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 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 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%

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%

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
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%

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%

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

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

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 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 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 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%

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%

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,

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 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%

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%

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 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%

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%

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%

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

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

Hello computer people,

I am a graduate student in microbiology and I need some help writing a macro in excel. My data (volt and current information) are collected every minute for 36 hours. I want to take the average of these values for hourly increments. I have attached a txt file where I tried to demonstrate what I was trying to do. Any help or suggestions would be appreciated as I am completely lost...

So I tried to create something like =average D(valueG2)(valueH2), so that I can calculate these ranges over the hourly increments. Ideally I would be able to do this for every hourly increment. For example-

For hours 0-1
the value in column g2 (or on the txt file 'value1')= 2
h2 ( 'value2')=61
I want the average D261 (voltage)calculated for mean volts

For hours 1-2:
D1= 'value 1'=62
D2= 'value 2'=121
average D62121
 

More replies
Relevance 49.2%

Hi,
I need some somewhat simple excel macro/scripting help.

Say I export a report from our database program into excel, basically, it is a 100+ page report with headings on each page. When we export to Excel, it shows the headings throughout. It is something like:

:BLANK SPACE:
:BLANK SPACE:
:BLANK SPACE:
Database: XYZ PAGE 2
USER ID: BLAH
:BLANK SPACE:
:BLANK SPACE:
:BLANK SPACE:

:Actual Data:

:BLANK SPACE:
:BLANK SPACE:
:BLANK SPACE:
Database: XYZ PAGE 3
USER ID: BLAH
:BLANK SPACE:
:BLANK SPACE:
:BLANK SPACE:

Etc.

What's an easy way to strip out that information so we have have concise spreadsheet? My guess, is: Search for the word "Database" and delete 4 lines above it and 5 lines below it.

Also,

When the report is exported to Excel, all the font formatting is stripped. So if we have lines like:

Office Supplies $300 (This is a total line, but doesn't state the word total)
Pens $100
Paper $200

Is there a way to search for a specific string, say I insert the word "total" to the certain lines, so it searches for that word "total" and it bolds entire land? Thanks for the help in advance, you guys rock!
 

Answer:More Excel/Macro help :)

16 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

Hi guys, i was wondering if you could help.

I simply cannot get my macro working,

I need the macro to take the value from a cell, e.g. "D9" and search for it in a data set which is in A5 to A9, once found it then needs to offset by two collums and enter a number 1 into the column.

I know this sounds simple, but i have given up hope

Please help

Thanks in advance

Jon3sey
 

Answer:Excel Macro help

6 more replies
Relevance 49.2%
Question: Excel Macro

I am using a program called MUST. It is for the electrical transmission industry. It uses excel to do its computations. It runs macros based on the buttons that were pushed on a form. It calls a .xla spreadsheet that has all of these macros. The worksheet is password protected. The outputs are excel based worksheets.

It has a feature to allow you to record the buttons that are pushed in it own .asc file format. If you run the code within this file format it gives you back a text file that is very hard to use. If you try to do the same function more than once it writes over top of the text file. It works while in excel but if you run it in .asc format it overwrites the file.

I would like to be able to record the buttons I press in this form in python so that I can recreate my steps quickly. Everything in this program is password protected, so I can't do a call on button push, because I don't know what the buttons are called. Excel will not record what I do within must.

I am thinking of possibly a program that can record various buttons I push. If possible I would like it to be python based, because that is the main program in my industry. If you have other suggestion, I would greatly appreciate the input.

Any suggestions would be greatly appreciated.
Thanks,
Joe
 

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%

Hello Gurues,

I need help creating a macro or something simular.

Situation: I got a spreadsheet w/ tons rows and columns of data. I would like to create a macro that will enable me cut and paste a particular sorted group and pasts in a new worksheet and naming the worksheet with the specific info that was paste. There are various groups that I would new a new worksheet for ie (cash, checks, money order, etc). How can I go about this?

Thx for any help provided.
EWart
 

Answer:Help With Excel Macro or VBA

7 more replies
Relevance 49.2%
Question: Excel Macro ?

I am confused and haven't worked with this much, so I need help. I have a user working on Windows 2000 and Office 2000 - she has a macro that we need to store so it is available in all spreadsheets. We were storing the macro in the spreadsheet that she uses it on but a file transfer that she runs, overwrites this spreadsheet and loses the macro. I hope this makes sense but if not, please feel free to email me. Thanks all!
 

Answer:Excel Macro ?

8 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%

Hey everyone,
i need some help with vb/macro in excel
i got two integers, lets say Value1 and Value2.
Value1 = 2
Value2 = 4.
i want the macro to goto a cell where the column is Value1 and the row is Value2.

is it possible?
 

Answer:Excel VB/Macro help

7 more replies
Relevance 49.2%

Excel 2013:

Hi Guys,

I have a simple excel macro that lopps through showing the sheets in a spreadsheet. All works well except once running I can't stop it.
Esc doesn't work
Ctrl Break doesn't work

Ideally I would like some code where I could assign a button to stop the macro running.

Sub StartSlideShow()
Application.OnTime Now + TimeValue("00:00:02"), "ShowNextSheet"
End Sub

Sub ShowNextSheet()
Dim lastIndex As Integer, nextShtIndex As Integer

If ActiveSheet.Index = Worksheets.Count Then Worksheets(1).Select

lastShtIndex = Worksheets.Count
nextShtIndex = ActiveSheet.Index + 1

If nextShtIndex <= lastShtIndex Then
Worksheets(nextShtIndex).Select
StartSlideShow
Else
MsgBox "End of slide show"
End If
End Sub
 

Answer:Help with Excel macro

7 more replies
Relevance 49.2%

I have a large excel spreadsheet. Each row is a separate record with multiple columns. The first column is an identifier (ID_x) and the remaining N columns are numerical features (features 1, 2, .... N). There are multiple rows (M) for the same identifier ID_x and corresponding N features. See the following example:

ID_1 feature1_1a feature1_2a .............feature1_Na
ID_1 feature1_1b feature1_2b.............feature1_Nb
...
ID_1 feature1_1M feature1_2M............feature1_NM
ID_2 feature2_1a feature2_2a .............feature2_Na
ID_2 feature2_1b feature2_2b.............feature2_Nb
...
ID_2 feature2_1M feature2_2M............feature2_NM
....

I want to create a new spreadsheet that contains a single record per ID_x. For each single record, the features are replaced with the average (or median, or stdev, ...) of the corresponding features. This is what I mean:

ID_1 average(feature1_1a,1_1b,...,1_1M) average(feaure1_2a,1_2b, ...,1_2M) ... average(feature1_Na, 1_Nb,...,1_Nm)
ID_2 average(feature2_1a,2_1b,...,2_1M) average(feaure2_2a,2_2b, ...,2_2M) .....average(feature2_Na, 2_Nb,...,2_Nm)
.....

Is there a macro to do this?

Thank you.
 

Answer:Help with Excel Macro

Hi Vicky,
Welcome to the forum.
In general macro's an be written for everything.
I don't know if it would help in your case but you could try a pivot table
A sample with non-private, non-sensitive data would help give a better picture and also you should always mention the version of Excel you're working with.
 

1 more replies
Relevance 49.2%
Question: Excel Macro Help

I'm working on creating a macro in Excel to automate some of my daily tasks. For the most part, I was able to make a successful macro using only the record function. However, I ran into a snag when I tried to get the macro to record my Ctrl + F function. I don't have too much (read: any) experience working with either VBA or macros, so I was wondering if someone here could help me out. This is what I would like for the macro to do
1. Search for cells with the value "12345"
2. Highlight all of the cells with the value "12345"
3. Delete all of these cells, and shift the remaining cells up
Any help would be greatly appreciated!
 

Answer:Excel Macro Help

Hi and welcome to TSG

Here's a little macro for you:

Code:
Sub Delete_12345()
Dim Rng As Range, WS As Worksheet, DummyString As String

'this DummyString is just necessary, you will see why :)
DummyString = "gibhu, etho et&#337;zohketok&#337;u&#337;ou&#337;(=%/HN "

'modify the sheet and cell range as needed
Set WS = Sheets("Sheet1")
Set Rng = WS.Range("A1:J10")

'changing/comuflaging the empty cells by filling them with a dummy string
Rng.Replace what:="", replacement:=DummyString, lookat:=xlWhole

'clearing the cells we look for (change all "12345" values into empty string)
Rng.Replace what:="12345", replacement:="", lookat:=xlWhole

'deleting the new empty cells (note: they were 12345 values just a moment ago)
Rng.SpecialCells(xlCellTypeBlanks).Delete Shift:=xlShiftUp

'recreatig the original empty cells by replacing the dummy strings by empty strings
Rng.Replace what:=DummyString, replacement:="", lookat:=xlWhole
End Sub
I'm sorry for leaving out Step 2., but highlighting the cells with the value "12345" doesn't make much sense, if they are all to be deleted anyway...

Jimmy
 

1 more replies
Relevance 49.2%
Question: Excel Macro

Excel_Macro
I am working with two worksheets. I would like to look at the value starting from A4 and down the A column in my master worksheet and when the value is greater than zero, copy all the data in that row from A to G and paste it in my destination worksheet from A to G. When pasting in my destination worksheet, i need to get back to the next empty row. Can anyone help me. I need this for my school project asap. Thanks.
 

Answer:Excel Macro

What kind of school project are we talking about. We normally don't provide the answers for what is otherwise considered "homework"

Rollin
 

1 more replies
Relevance 49.2%
Question: Excel Macro

Hello all, long time since ive posted, need some help from you guys again please.

i have made an excel macro, on the excel page you have a drop down menu which you can use to select an option from. When you have selected something numbers appear in the cells below.

the problem is that i want to be able to protect those cells in which the value appear, i dont want users to be able to modify these cells, but when i protected the sheet the program cannot write to the cells and therfore i get an error.

is there a way around this please?

Thanks all.
 

Answer:Excel Macro

Here's what I would do.
1. Put those cells on a separate worksheet. Call this sheet the "Descriptor"
I guess those cells are the controlsources of dropdown lists, listboxes, etc. I would put the rowsources of the controls on the same "Descriptor" sheet.
2. Put the controls themselves on a userform.
3. Hide the "Descriptor" sheet.
4. Protect the workbook with a password.

This way the users can't unhide the "Descriptor" sheet, so they can't modify any data there. They also won't be able to see the data on the "Descriptor" sheet, but that's not a problem, since they have it in the listbox or dropdown list. But you can read/write it via VBA code. Does that suit you?
 

2 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
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%
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

Hi All

Just started using Macros last week, so not an expert but can understand the very basics. I have written the following code below, and it works except for when it gets to th bits highlighted in red. It then asks for an update on values but I can't understand this.

Thanks in advance for any help!!

ActiveWindow.SmallScroll Down:=-21
Sheets("Sheet2").Select
ActiveWindow.SmallScroll Down:=-31
Range("A1").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" & Range("R1").Value, Destination:=Range _
("$A$1"))
.Name = "MItest1204"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 850
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileOtherDelimiter = &qu... Read more

Answer:Excel Macro Help

No bother, I've found the answer.
 

5 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%
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

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'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 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: 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

Using windows xp and office 2003

I recorded a Macro which jumps from sheet to sheet and filters data. The macro works great but when I run it I can see the screen jumping from sheet to sheet. How can I hide this so that my macro runs in the background and only producers the result?
 

Answer:Excel Macro Help

Code:
Application.ScreenUpdating = False
Regards,
Rollin
 

3 more replies
Relevance 49.2%

I'm trying to update (& create) some macros in Excel (for WinXP) and all of a sudden it's using absolute values instead of relative values. Fine, okay, I select the relative value button and try again, but now the macro is skipping a column between each entry, when it should just be going to the next column. I'm at my wit's end and I need to get this fixed NOW. Help!!!!
 

Answer:Excel Macro - Help!

13 more replies
Relevance 49.2%

OK, I have a simple spreadsheet - 2 tabs (1 with raw data, and 1 for reporting results from the data). For this problem I have 4 columns on the data tab I'm concerned with: Instance, Date of Instance, Time of Instance, and Instance Description. The Instances have about 50 different names. I need the macro to search for a specific instance (call it "Network Fail"), and when this instance is present on the data sheet; record the Date of Instance, Time of Instance, and Instance Description in the appriopate cells on the reporting results tab. I am fairly new at macros, but have a good understanding of excel - can anyone help me please??!!

Answer:Need Excel Macro Help!!!

Is there more than one occurrence of a given "instance" e.g. Network Fail that you need to pull data about?If not, could you simply use VLOOKUP?Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.

6 more replies
Relevance 49.2%

I’ve to convert Excel macro which is written in 95 to Excel 2000. I’ve no idea where to start or how to go about to do this. Any pointers/ideas/suggestion is greatly appreciated.

Thanks,
Helen.
 

More replies
Relevance 49.2%
Question: Excel Macro

I am new to macros. I have a excel spreadsheet for technical assistance. There are sheets for various sites and there is a summary sheet. There are columns asking for the date of request and the date of resolution. If there is a date of request and a date of resolution it means the issue was solved but if there is no date of resolution it means the issue was not resolved. The total number of resolved and unresolved have to be then entered in the summary sheet. I have this macro so far but I keep getting out of range error. Please help.

Sub Macro()
Dim R As Long
Dim S As Long

Sheets("Sheet2").Range("C9").Activate

If IsDate(Cell) = True Then
ActiveCell.Offset(0, 1).Select
If IsDate(Cell) = True Then
R = R + 1 'resolved issues
Else
S = S + 1 'unresolved issues

End If
End If


Sheets("Summary").Range("B9").Activate 'go to first sheet

Range("B9").Value = R
Range("B10").Value = S

ActiveWorkbook.Save


End Sub
 

Answer:Excel Macro

After posting the last message I was able to get the macro to go past the subscript errors but the macro is not calculating the value of R and S correctly...PLEASE HELP!!!!!!!!!!!!!!!
 

3 more replies
Relevance 49.2%

1. Find and select the last column that contains data from worksheet1.2. Copy this entire column to worksheet2.Please help! Thanks!

Answer:Need a VBA Excel macro to do the following:

You will need to play with this but it should give you some ideasSub MyTest() Dim iEndRow As Long, iEndCol As Long iEndRow = Range("B65536").End(xlUp).Row 'find a column that always has data iEndCol = Range("AZ" & iEndRow).End(xlToLeft).Column MsgBox iEndRow & " " & iEndCol Columns(iEndCol).Copy Sheet2.Select Sheet2.Range("A1").PasteSpecial (xlPasteAll) 'change the column to one of your choice End Sub

2 more replies
Relevance 49.2%
Question: Excel macro??

I have a problem in Excel which I assume can be solved with a macro, but I cannot find the right solution.

I want to set up a template with a 4 character code (such as abce or a134) going into a particular cell - say cell b4. I want this then to set up a file in a folder in my documents with the code in cell b4 being the file name. The aim is that I should only have to press Save when the rest of the spreadsheet has been assembled. It is not a big spreadsheet - a single page.

Hope this makes sense.

TIA
 

Answer:Excel macro??

6 more replies
Relevance 49.2%
Question: excel macro

Hi

I have been playing around with a macro I was shown at College many moons ago before I realised I would never be any good at VBA.

The macro simply unhides a protected worksheet and copies it to the end of the workbook, then displays an input box asking you to name the sheet.

After remembering why I was no good at VBA for a few hours, I got it all working except 1 thing....The new worksheet won't move to the end. The first one does, but the rest go in front of this one.

The vba code follows, I suspect the problem is with the "Copy After:=Sheets(10)" line, but have lost patience.
.....................................................................................................
Dim NewPageName As String
Sub NewPage()
'
' NewPage Macro
' Macro recorded 28/01/2003 by
'

'
Sheets("Master").Visible = True
Sheets("Master").Copy After:=Sheets(10)
Sheets("Master").Select
ActiveWindow.SelectedSheets.Visible = False
NewPageName = InputBox("What would you like to call your new Worksheet")
ActiveWindow.ActiveSheet.Name = NewPageName
End Sub
.......................................................................................................
 

Answer:excel macro

6 more replies
Relevance 49.2%
Question: Need excel Macro

Good dayI need help creating an Excel Macro. I have some names in a column, followed by some numbers in the next column. I need to have Excel copy the names and numbers for each, in some other cells.Since I am a beginner I do not know of the basic commands so even this IF then is a mistery to me. If anyone can help explain how it should be written, I can do the rest. Thank you.

Answer:Need excel Macro

You'll need to supply some more information, perhaps with some "before and after" examples of your data.Data can be "copied" with simple formulas, so I'm assuming you need something more sophisticated than that.Before you post any data, please click on my signature line and read the posting instructions available via that link.Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.

2 more replies
Relevance 49.2%
Question: excel and macro

I am new to macros. I want my excel sheet to populate a ready-made word doc by putting in the data from the cell I click on, and no more than that.
Anyone help an absolute beginner to this stuff?
 

Answer:excel and macro

moved to business applications forum
 

2 more replies
Relevance 49.2%
Question: Excel Macro

I have a CSV file that exports to excel and produces and sorts various pieces of data with some simple macros, what I am then left with is a sheet of information that I need to paste into a MSWord table, the table already has the font and style formats that I need, but because the data is based on the information from the Excel workbook I cannot predict the number of rows needed, although this number is displayed in a single cell in the workbook. When the table has been pasted I would need to be able to rename and save the Word document using a week number, displayed in the workbook as the file name. Is it possible to write a piece of VBA code to handle this?
I should have said I am running office 2002
 

Answer:Excel Macro

8 more replies
Relevance 49.2%
Question: Excel Macro

I think what I'm trying to do is a macro, and anyways, I know you can do it all the way back to Excel 95.

Here's what it is, it's so simple:
1) I have 3 spreadsheets
-a) Master list of all accounts
-b) terminated accounts
-c) active accounts

I need to make a) search both b) and c) and color a row according to where it finds the name.

There are a couple other provisos/problems but I can get that sorted out by hand, or work on it later, the vast majority of the data is just going to be "Is it here? No. Okay, is it there? Yes, okay, color it blue"

I tried to google some walkthroughs, but like I said, I'm not even sure if "macro" is the right feature that I'm looking for.

Answer:Excel Macro

You will want to use Live Search and Office Online to find answers for Microsoft Products. Google doesnt spider Microsoft sites.

how to create Excel Macros - Live Search
http://office.microsoft.com/en-us/ex...047111033.aspx

5 more replies
Relevance 49.2%
Question: Excel Macro

Hey all,

I’m just a beginner with macros so would really appreciate your advice. I’m dealing with a large database where I need to plot hundreds of emails. However, some entries are repetitive in terms of e-mail ending. I would like that ending to be a sort of a reference point for other entries… let me explain

I would like to plot a ‘reference’ entry eg. [email protected] in say A1 so that in A2 I just have the actual ending of A1 after the [email protected] sign, resulting in [email protected] – that way I could simply plot the beginning without the ending (so saving time)- and even if the next cell will be e.g. [email protected] I then want that cell to be a new ‘reference’ – is that even possible?

Thanks

4man
 

Answer:Excel Macro

You could simply do Data, Text to Columns, Delimited and use the @ sign to split the email addresses into two columns, the first being (from your examples) in Column A:
meandyou
youandme
and the second in Column B:
good.com
ok.com
Then sort by Column B and you will have all the emails with the same endings together.
Then, say, if you wanted page breaks at each point where the ending changes, I have some simple code that would do that for you....
 

1 more replies
Relevance 49.2%
Question: Excel Macro Help

Hello All,

I am using Access 97 to generate a database. After entering data into forms in Access, the user then clicks a button which opens a report in excel. I have created a macro in excel which should automatically maximize the worksheet in excel. This macro also changes the active worksheet to "sheet2". The part of the macro which changes the active worksheet is working fine when I load the report through access, but not the part of the macro associated with the maximization of the window. Both parts of the macro work if I open excel on its own (ie: not through access). Below is my code:

Sub auto_open()

Worksheets("Sheet2").Activate
ActiveWindow.WindowState = xlMaximized

End Sub


Any suggestions?

Thanks in advance for your help.

engineer_in_training
 

More replies
Relevance 49.2%
Question: Excel Macro

I have turned on the Macro to automatically update a spreadsheet every time it is opened. I need to be able to stop this so I can save a copy and add notes to this worksheet. How do I disable this macro? Even when I save it as another name, when I open it next time is updates the data.

I am using Excel 2000.

Thanks
Nancy
 

Answer:Excel Macro

Generally, holding the shift key while opening an Excel file that contains workbook_open or auto_open macros should disable it from running until you close and open again, this time without using the shift key.
 

3 more replies
Relevance 49.2%

I'm trying to create a macro that will copy rows 1 & 2 and paste it in the row containing the last value in column B + 1. The goal is to allow a user to insert a repeatible header throughout a worksheet as needed. Admitedly I'm stumped how to find the last column with a value and move down 1 before the paste.
 

More replies
Relevance 49.2%

I am designing a ?basic? database in work and having trouble with some macrosThe database is a record of production. Information is added at pre and post production. Adding the pre-production information I have sorted. A form is filled in, submit button hit and a new row is created with the information in. Along this row there are gaps where post production information is entered, but trying to get this information to paste into the correct row I cant do.I have a form to fill in the information (one each for pre and post production) which I then want adding to the database against the reference number. Converting the information from the input form into the database I can do for pre production, but getting the post-production data entered into the database along the correct row I don?t know how to get there.I believe I want a search function that takes the database reference number (on the post-production form) and finds this in column A. once this ref number is found, the cell is active and I can to paste the information from the post production form into the gaps on the correct row Anyone have a clue?

Answer:help with Excel macro

Can you clarify a point here?  Your title is "help with Excel macro".  Excel is a spreadsheet program, yet you refer to a database over and over and do not once mention a spreadsheet or other terms, such as Workbook or worksheet, which imply Excel.  Macrosoft Access a database and is part of the Pro version of Microsoft Office.  So, are you using Access?  If not, I'm curious why you keep referring to database when you are using Excel, a spreadsheet program.  Or, are you using both for that application you are working with? 

10 more replies
Relevance 49.2%

Hello,

I'm looking for some help with a macro I am working on in Excel. So far my macro leaves me with the data on sheet 1 of the attached book1.xls file. What I would like the data to look like after the macro is run is on Sheet 2.

It's difficult to explain in words but I am hoping someone with experience will see this as pretty simple. I'll try to give a representation below of what I am looking for so you don't have to look at the attached file to get an idea of what I need. The changes I need the macro to make are highlighted in red on sheet 2.

Sheet 1:
100 | 328
100 | 328
100 | 328
100 | 328
95 | 95
45 | 45
100 | 245
100 | 245
100 | 245

Sheet 2

100 | 328
100 | 328
100 | 328
28 | 328
95 | 95
45 | 45
100 | 245
100 | 245
45 | 245

Any help is greatly appreciated!
 

Answer:Excel VBA Macro Help

8 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

I need some help in writing a macro in Excel. Here's what I want to do: When a check box is clicked, I want the actual value of a text field to be changed to negative and the value to be displayed in the same text field not copied to another field as would be in an if statement. Please help!

Thank you,

M.
 

Answer:Excel Macro Help

catalina you already asked a similar question here....

http://forums.techguy.org/business-applications/700029-excel-help.html

bomb21 has given you a response....

don't double post
 

2 more replies
Relevance 49.2%

I'm trying to create a macro that will look at a specific cell of a worksheet (B14) and then either print and close active worksheet, just close the active worksheet or look for second sheet and repeat the process depending on whether or not cell B14 contains text that says "no activity". I guess the tricky part is that sometimes there will be two worksheets (for example Contract 2009 and Contract 2010) and sometimes there will only be one. I need to incorporate an instruction to look for the second worksheet and again either print then close or just close. Not sure how (if even possible) to do this. Thank you in advance to anyone who can help me figure this out.
 

Answer:Need help with Excel Macro

Hi,
Creating a pivot table is a one-off activity, and the overhead of writing a macro to do it surely exceeds the work involved in just creating the pivot table.
I can suggest a macro for creating the worksheets and copying the rows.
Thanks
 

2 more replies