Re: OnTime Method Sending Emails Twice
Yes you are right, I started the macro twice.
Re: OnTime Method Sending Emails Twice
Yes you are right, I started the macro twice.
Hey guys,
I have a macro that I run overnight, which sends out emails every hour. For some reason it sends out every email twice, but I am not sure why. Hep would be much appreciated, thanks.
Option Explicit
' Set the mailing times
Sub Timer()
Application.OnTime TimeValue("07:00:00"), "SendEmail"
Application.OnTime TimeValue("08:00:00"), "SendEmail"
Application.OnTime TimeValue("09:00:00"), "SendEmail"
Application.OnTime TimeValue("10:00:00"), "SendEmail"
Application.OnTime TimeValue("11:00:00"), "SendEmail"
Application.OnTime TimeValue("12:00:00"), "SendEmail"
Application.OnTime TimeValue("13:00:00"), "SendEmail"
End Sub
Sub SendEmail()
'Requires a reference to the Outlook Object Library
Dim OutlookApp As Outlook.Application
Dim MItem As Outlook.MailItem
Dim EmailAddr As Range
Dim Subj As Range
Set EmailAddr = Range("P1")
Set Subj = Range("P2")
'Create Outlook object
Set OutlookApp = New Outlook.Application
'Create Mail Item and send it
Set MItem = OutlookApp.CreateItem(olMailItem)
With MItem
.To = EmailAddr
.Subject = Subj
.Body = ""
.Send
End With
End Sub
Display More
Re: Variable Or Dynamic Ranges
I did not define MyRange... as what should I define it?
Re: Variable Or Dynamic Ranges
I get the following error:
"Method 'Range' of object '_Global' failed"
Re: Variable Or Dynamic Ranges
I am a a little confused to be honest...
is this how it would have to look?
Re: Variable Or Dynamic Ranges
Thank you.
How would you define Myrange, given that its length may vary (Range("F65536").End(xlUp)).
Hi guys,
I am not even sure if my title matches my problem, but it was the best I could think of. Please take a look at the following code...
Sub Test()
Dim cell As Range
For Each cell In Range("F4", Range("F65536").End(xlUp))
cell.Offset(0, 3) = cell.Offset(0, 2)
Next cell
End Sub
Display More
I use similar codes quite a lot. The issue with this is that if I want to add columns or delete columns later on to my spreadsheet, I need to go and change all the previous codes so the columns match up.
My question is, how else can I write a code that has similar functions but with changing references in case I do add or delete columns? I understand that I can define ranges, but I am not sure how I can work with that within a macro.
I am almost sure there are different solutions to this problem, and I would appreciate and be interested in knowing all of them to put them in comparison.
I thank you guys in advance, and please let me know if I let anything unclear.
Thank you.
Zeroman
Hi,
I have read through several of the previous posts about printing an excel file to pdf, but none of them really do what I want to do. So I guess it's fair to post a new post about this common subject.
I have Adobe installed on my computer. Here are the steps that I want to do...
1. Select an area starting from A1 down to the last populated row in column A and over to let's say column B.
2. Save the range as a pdf, without having to name the file manully. So let's just say vba automatically saves the file as "file1.pdf" on the c drive.
4. Repeat step 1 and 2 with a different range and different file name. So let's say in the second run it highlights C1 down to the last populated rown in column B and over to column D. Then saves it as "file2.pdf" on he c drive.
3. Attach file1.pdf and file2.pdf to an outlook email and send it to [email protected] & [email protected]
I greatly appreciate your help on this.
Thank you.
Re: Multiple Format For Single Cell
This is just great. Thank you so much.
I was curious if it is possible to give a single cell multiple number formats based on what the number is in the cell.
So for example if my number is bigger than 1000, I would like to use comas so that it looks like this 1,000. However, if it is less than 1000 I would like it to look more like this 999.00.
Is this possible?
Thank you.
P.S.: Would prefer to stay away from VBA (at least in this case)
Re: Highlight Every Other Row
this is awesome, thank you
Re: Highlight Every Other Row
Thanks guys,
but both codes will only do part of what I want. Let me try to explain my situation again...
let's say there are no rows hidden, and I use either one of your codes. They will highlight every other row. Let's say I decide to hide row #10 which is a highlighted one, what will end up happening is that row 9 and 11 will come together, and both will not be highlighted... but I want every other row to be highlighted. As in this case if 9 was not highlighted, and 10 was hidden, I would want 11 to be highlighted again.
Ranger, your code just skips highlighting rows that are hidde but that doesn't solve the problem of having every other row highlighted. In the above case, I would end up having row 9 10 and 11 not highlighted.
I appologize for the confusion.
Hey guys,
I need a code that will highlight every other row in a some color.
I would like the macro to start in row 7 and use column A as a reference to know when to stop (last populated row in column A is where it needs to stop).
The rows that get highlighted can all get highlighted in the same color, and the entire row can be highlighted.
The twist to this is that there are hidden rows in the range and I want the macro to disregard those.
Just for clarification with highlighted I mean colored.
Thank you in advance.
Re: Formulating A Formula
this works, great. thank you.
let me ask an additional question...
This code picks up its first data point from row 7 on the Sheet "Report". I want it to pick up its first data point from row 2 on the sheet Report. But I can't use R2C2 since this formula is being draged down into the next cells.
Thank you.
Hi guys,
I had more of an excel questions.
Let's say
A1 "=D1"
A2 "=D4"
A3 "=D7"
so baiscally the row reference increases by 3. How could I write a cell formula for A1 and so that I can just drag and drop it down for the rest of the cells?
Thanks.
Re: Correltaion Matrix
I am sorry, I put it on my geocities server, it should work now.
http://www.geocities.com/procomphd/correl.xls
Thanks for looking into this.