VBA COde for adding CC, BCC to email sent from excel. I already have the below code to send email from worksheet, i need to add a copy email.
Private Declare Function ShellExecute Lib "shell32.dll" _ Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _ ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, _ ByVal nShowCmd As Long) As Long
I've managed to use some code I found to add a new row below the selected row, and duplicate all the forumlas of the source row. It worked fine dozens of times yesterday, but today it's decided not to work. It gets as far as creating the new row(s), but then just hangs & excel crashes before duplicating the formulas. I've even tried reverting to an earlier version, which also worked fine, but this crashes also!
Sub Add_New_Row() ' Unlock Worksheet Worksheets("Sheet1").Unprotect Password:="*****" Dim x As Long ActiveCell.EntireRow.Select 'So you do not have to preselect entire row If vRows = 0 Then vRows = Application.InputBox(prompt:= _ "How many rows do you want to add?", Title:="Add Rows", _ Default:=1, Type:=1) 'Default for 1 row, type 1 is number If vRows = False Then Exit Sub End If 'if you just want to add cells and not entire rows 'then delete ".EntireRow" in the following line Dim sht As Worksheet, shts() As String, i As Integer Redim shts(1 To Worksheets.Application. ActiveWorkbook. _ Windows(1).SelectedSheets.Count)..................................
I'm verrry new to editing VBA code and I've been trying to figure out how to send a column of data ("Min Data" AB3:AB21 from "Sheet1") to a worksheet ("F4" - Min) and sending another column of data ("Max Data" AC3:AC21 from "Sheet1") to a different worksheet ("F4" - Max) by using only the one button ("Record Data" from "Sheet1"
I've been trying to figure out ways to edit the VBA in "Module 1" to make this work
Can anyone help me out here? If what i'm asking for isn't clear enough, just let me know and i'll try to explain in more detail.
The loop is putting the correct formula into the cell - but THEN... - I wish to (within the loop and before it moves on) check if the value is equal to OR greater than 1 - if it is, make it a value of 1 (this '1' is then used at the bottom of the column of data to give a total). I need to do this before it moves onto the next cell. What am I doing wrong? Is it because once it puts formula in the cell, it then moves down - do I need to select the cell again first? As I had originally posted on this site - link: url]http://www.excelforum.com/showthread.php?t=641970[/url]
The issue is the I want to put the condition here in my the code that only copies the desired cells if the sheet is named specifically such as "Jan", if not named as this the worksheet should not be used. The current code I am using was posted on this site in 2009: VBA to copy specified cells from all the files in a folder
My modified code is:
Option Explicit Public strSourceFldr As String Public EachFile As Object Public objFSO As Object Public objFolder As Object Public objFile As Object Public strSheetName As String
I was wondering if there's a way to make the numbers in a column over 50 (as an example) green and numbers less than 50 red. (The numbers in this column are the sums of other cells, but I guess that doesn't really matter.)
This way when there's a lot of things going on you can see what's what without filtering or rearranging.
I want to display value from cell A11 to J11, and when the button is clicked, I need to transfer the value to underneath the last value on sheet “Results” leaving 1 space. So in my example it would go into row 28. On other occasions there may only be 1 value for example on results, if this was the case the row from Additional parts would have to display in row 7.
Then if I were to add another value in additional parts I would then want this to display in row 30 in my example. So again leave a space and add the line.
I have the following code that updates columns A,B and C. The columns are hidden and have some 500 plus rows. Cell E2 reads the last entry in column A (a date, such as 1/22/10). I would like to add a line in the code that, if cell E2 equals todays date, will prevent a second update and display a message "Update Complete".
I have just discovered the exciting world of the additional controls that can be added to userforms. provide me with some sample code to make a progress bar increment and to activate a windows media avi file from a user form. I only need to know the code (I know how to add the controls etc)
Code: Sub Final() Dim NameCell As Range For Each NameCell In Sheets("! Names").Range("B1", Sheets("! Names").Cells(Rows.Count, "B").End(xlUp))
I want to pull data from ! Names. This code already Renames a new sheet from the ! Names sheet and also puts there name in cell C2 and phone number into cell C3 of the created sheet. I want to put more data from the ! Names sheet. How would i go about adjusting current code to do that?
A procedure residing in the "ThisWorkbook" module has just added a new worksheet into the active workbook. I now want this same procedure to write a set of code into this new sheet's code module.
Solution 1: Create a worksheet before run-time that is already set up with the code you want behind it. Then, use this worksheet as a sort of "template" when you want to create a new worksheet as opposed to using the worksheet.add method.
Question: I can use solution 1, but isn't there a way to insert the code on the fly?
The code below resides in my personal.XLS Module. When I step through the code everything works till it reaches the point in red then I get the pop up that says excel needs to close and asks to send or not to send.
I noticed that if I choose recover my work and restart excel and I look at the code in THISWORKBOOK of the recovered workbook that the code I wanted placed there is there.
Can anyone explain why this is happening? I have the macro's security set to low and a check mark in the trust access to vb projects.
I have a macro which I use to do all sorts of routine things on a spreadsheet for my employees. (you guys helped me with that too. thanks)
I would like to add a command button to this sheet to run series of code and I want to add this to the final step of a macro.
Question, is there a series of code, which would 1. create the command button on the active sheet, and 2. add the required code to the command button, and 3. embed that button and code onto the active sheet all at once.
I need to do this regularly so it is a currently manual process I am trying to replace.
Ex. of code I want placed:
Rows("1:1").Select Selection.Font.Bold = True
This is not the exact code which I will use, but it will help me to understand what I would have to do to make it work.
I have a spreadsheet with 20 or so columns but that number can change at any time. I need my code to by dynamic so if a column is deleted (or added) my code will still work.
Each column has a name in row 2 and I'm trying to use that in order to make everything dynamic. For example, my code counts the number of blue cells in colums D4:G68, but now if someone adds a column before column D, everything gets messed up and it will still count the cells in D4:G68 but I want to use E4:H64 now. Does that make sense? I have made code that searches the column names and returns the column number to correspond to the name. How would I change this?
Range ("C8") = "= CountBlue(E4:G68)"
the code doesn't look exactly like this, I believe it is actually in R1C1 format
I'm just trying to add the "=" operator to the below "" operators, as this line of code presently doesn't account for any numeric matches, of which I have plenty, and DO need to account for! Gosh, might someone here know how to integrate such a thing into this code?
I'm working with a column that contains dates. The dates are pulled from a system that doesnt always have dates in the format
mm/dd/yyyy => 09/26/2014
but instead sometimes 9/26/2014 or 4/7/2014
i.e., 0's are missing.
I'm looking for a macro that inserts these missing 0's
**So I suppose the criteria should be that if the cell is 9 characters long (including the "/"s), then it adds a 0 as first character** and ***the cells that are only 8 characters, in that case there would have to be insert 0 again as character 1, and 0 as character 4 (if 0 is already added as first)***
I'll attach a file that contains dates : test.xlsâ€Ž