Automatically Save My Workbook When A Certian Cell Range Is Changed

Jul 21, 2009

I am very new to vba and trying to figure out an auto save macro that will automatically save my workbook when a certian cell range is changed. Right now I have a macro set that automactially record the time and date of when a change is made to the name cell, I want to set up a macro that will automatically save the file when the time is updated.

This program is used by several users and they have a tendnecy to forget to save the program so that when other people want to check the updated data nothing has changed because the changes have not been saved. I have attached the file that I am working on. When a change is made in column F then Column G automatically updates, now I want column G to trigger autosave. I would also like a msgbox to appear to tell user that file has been saved.

View 3 Replies


Save When Cell Is Changed?

Jul 24, 2009

Is it possible to save a workbook whenever any changes are made to any cell in a specific column? The reason - I'm putting an excel workbook out on a network drive for 4-5people to share. The sheet contains work items which are imported every 4 hours... Column A contains the status.

I want to save the file every time anybody changes a status to prevent multiple users from working on the same item. I realize that I could build a form then load each workitem into the form, then apply the save to a change event on the field/control, but that's something for next week - I need to get this out the door, bare bones, as soon as possible.

View 2 Replies View Related

Automatically Calculate Cell When Changed

Oct 24, 2006

There is a column in my spreadsheet which needs to reflect a " percent done".
I used to enter just a numerical value in (eg. 20) to reflect 20% done. My boss wanted it to show as an actual percentage (eg. 20%). I changed the format to Percent, Zero decimal places. Then you had to enter .20 to get the 20% to show.
Now my boss doesn't like that - and wants to be able to enter "20" to get the 20% to show. I put the following code in my SelectionChange event...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'other logic
If Target.Column = Asc(PercentDoneColumn) - 64 Then
If Target.Value <> "" Then
Target.Value = Target.Value / 100
End If
End If
'end other logic
End Sub

My problem is that this works well when putting a new percentage in, but not for when you click on a cell that already has a percentage in it. For example, if you have .2 (displaying "20%" in the cell), and click on that cell, it divides that number by 100, and gives you 0.2%, displaying as "0%". I want to enter a number between 0 and 100, have it displayed and stored as a percent. At this point, I'd settle for the displayed, but would prefer to have it stored as a percent, too.
I also want it to not reset my value unless I'm putting a new value in!

View 4 Replies View Related

Automatically Calculate 2 Cells Based On Cell Changed

Apr 25, 2009

I have some rather complex formulas that when a value is placed in one of any three cells it solves for the other two, taking values from other places on a worksheet (including the cell itself).

Scenario: Cell F10, G10, and H10 all have formulas in them. If a value is placed in F10 it solves for G10 and H10. If a value is place in G10 it solves for F10 and H10. If a value is placed in H10, it solves for F10 and G10.

I really do not think the actual formulas matters at this time...

Has anyone done this before, using VBA code to place the formulas in cells F10 G10 and H10? Look for a working example of this if possible.

View 9 Replies View Related

Automatically Save Workbook Every X Minutes

Oct 27, 2008

I've created a MsgBox that if you do not respond or Click on it within a set time it will either disappear or perform an action upon no selection. It works great....IF itís the only excel workbook open. If there is a second workbook open (Even if the second WB is minimized) then the MsgBox just stays up and the "Timer" no longer works. My Code is as Follows:

Sub TimedMsgBox()
Dim Box As Object
Dim varResponse As Variant
Dim Res As Long
Set Box = CreateObject("WScript.Shell")

varResponse = Box.Popup(Text:="Which button will you click?", secondstowait:=5, Title:="Click Me!", Type:=vbYesNoCancel)
If varResponse = vbYes Then
MsgBox "You clicked Yes"
ElseIf varResponse = vbNo Then
MsgBox "You clicked No"
ElseIf varResponse = vbCancel Then
MsgBox "You clicked Cancel"
ElseIf varResponse = -1 Then
Res = Box.Popup(Text:="What? Do you not like me?", secondstowait:=5, Title:="You Didn't click Me!", Type:=vbOK)
End If
End Sub

View 9 Replies View Related

Automatically Add Username, Current Date And Time Each Tiime Any Cell Is Changed

Feb 27, 2009

I am looking to have a macro which will automatically add the username and date to a cell, when the cell above changes (or in this case =x). I have a bit of code from a previous project, but I have changed Target.Row to Target.Column and it is not behaving as I require:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Range("B2:BZ2"), Target) Is Nothing Then
Range("C" & Target.Column).Value = Format(Date, "dd-mmm") & " " & Format(Time, "hh:mm") & " by " & (Application.UserName)
End If
End Sub

See the attachment for the example. What I need is whenever row 3 ="x" I need the corresponding cell in row "d" to update with the latest date, time and username. Please not the macro is currently not active on the sheet as i've added the ' character.

View 3 Replies View Related

Automatically Call Macro Based On Changed Cell Address & Text

Apr 13, 2009

I have the following code pasted into the worksheet module which used to work fine but no longer does. I didn't touch the code, it just stopped working.

Private Sub WorkSheet_Change(ByVal Target As Range)
Select Case Target.Address
Case "$A$16"
Select Case Target
Case "Custom Color 1": Call CustomColorInput1
Case "Custom Color 2": Call CustomColorInput1
Case "Custom Color 3": Call CustomColorInput1
Case "Custom Color 4": Call CustomColorInput1
Case Else:
End Select
Case "$A$17"
Select Case Target
Case "Custom Color 1": Call CustomColorInput2
Case "Custom Color 2": Call CustomColorInput2
Case "Custom Color 3": Call CustomColorInput2
Case "Custom Color 4": Call CustomColorInput2
Case Else:
End Select
Case "$A$18"

CustomColorInput 1-6 are the same except they input data into different cells F16-F21.

When I attach any of the CustomColorInput macros to a button it works fine. When I try to call it from the worksheet module, the data input box pops up but the data doesn't get entered into the cell. When I try to step through the CustomColorInput macros using F8, the input box pops up, I enter data and press ok. Then I continue with F8 and the debugger jumps to a custom function that I entered (below), which is not called for and is in no way related to the code.

Function PullAfterLast(rCell As Range, strLast As String)
PullAfterLast = Mid(rCell, InStrRev(rCell, strLast) + 1, 256)
End Function

When I close VBA, the data that I typed into the data input box is in the correct cell.

So basically, I'm getting three different responses from the offending code depending on how I call it up. Can anyone tell me what's going on?

More generally, in this and previous occasions, I've had problems with macros that cease to work for no reason that is apparent to me. What are some things that would cause a macro to stop working, without actually changing the code (other than the obvious, like referring to names or worksheets etc. that don't exist anymore)?

View 9 Replies View Related

Automatically Save Sheet To New Workbook When Closing

Jun 30, 2008

I am in the process of setting up an Excel invoice. So far I have managed to implement the following:

On open: Incrementing invoice number
Cells cleared ready for next use

Private Sub Workbook_Open()
Sheets("Sales Invoice").Range("H2").Value = Sheets("Sales Invoice").Range("H2").Value + 1 .....................

There is only one task left I need to automate. On closing the document I would like a copy to be saved in a specific folder and be given the file name of a cell (B9). Obviously I would not want the 'saved copy' to retain the Incrementing invoice number or the clear cells function. Even if the invoice copy was exported as a flat jpeg that would be fine. I am using Office Exce 2003 (Sp2) - I have attached my invoice should anyone be kind enough to take a look.

View 3 Replies View Related

Moving (pasting) A Range From In Between Certian Rows

Jan 15, 2009

Here's what I want it to look like:

Here's Macro Code I have thus far: ....

View 9 Replies View Related

Sort The Certian Cell

Jun 19, 2007

I have a column which consists of different dates. Some dates have a letter behind them (12.6.K). When I sort them they don't come in order because of the letter.

View 9 Replies View Related

Cleans Certian Cell Values

Jul 25, 2009

Im looking to clean up the way the code is writen.
It Cheeks for cell value if correct then paste data onto another sheet then cleans certin cell values.

View 6 Replies View Related

Automatically Fill In Column When Certain Cell In Column Changed

Jun 18, 2009

I am trying to have some automation to my WS and what I want to do, is if a certain column (column 104) is changed, it will fill out that column with the data entered as long as the account is the same (column 5). Here is the code I tried, but realized very quickly, it puts me into a loop. This is being called by a change worksheet fuction

If Target.Column = 104 Then
If IsEmpty(Target) Then
testacct = Cells(Target.Row, 5)
temptest = testacct
s_TempSwitch = Target.Value
Testoffset = 0
Do While temptest = testacct
temptest = Cells(Target.Row + Testoffset, 5)
Cells(Target.Row + Testoffset, 104).Value = s_TempSwitch
Testoffset = Testoffset + 1
End If
End If

View 3 Replies View Related

Automatically Run Udf When Color Is Changed

May 2, 2007

I have a UDF that goes like this:

Function SumIfPurple(inputRange As Range, _
answerRange1 As Range, _
answerRange2 As Range) As Variant
Dim SumAnswer As Variant

'If inputRange is turned purple then it is equal to anserRange1, if it is left with no fill it is equal to answerrange2.

If inputRange.Interior.ColorIndex = 39 Then
SumAnswer = answerRange1.Value
SumAnswer = answerRange2.Value
End If
SumIfPurple = SumAnswer
End Function

I would like to have a sub that will have the formula automatically calculate when the inputRange's color is changed.

View 6 Replies View Related

Save Range In A New Workbook As .gif

Sep 27, 2009

Save range in a new workbook as .gif
This is the macro :

View 5 Replies View Related

Run Macro Automatically Once 3 Cells Have Changed

May 21, 2008

how to alter this Private Sub for my code to execute automatically once all 3 cells have changed. At the moment it executes as soon as any of the 3 cells change.

Here's the Private and Public Sub codes:

View 9 Replies View Related

Update PowerPoint Automatically When SpreadSheet Is Changed

Apr 10, 2014

I'm trying to code so that any changes made to Excel document will automatically change in PowerPoint. I have Copied and Pasted Special link so that its connected but when ever a change is made in Excel in powerpoint I get a pop up box saying I need to press update. But I want to bypass the pop up update box and have it so that powerpoint automatically updates when I change something in Excel.

This is the code I have so far. I don't know if it's right or if I am on the right track as I get a compile error saying I need a End with.

[Code] .....

View 4 Replies View Related

Macro To Save As Workbook 2 From Data In A Cell From Workbook 1

Sep 28, 2012

I have two workbooks open. I need to "Save As" and close workbook 2 with a file name from a cell in Workbook 1. The macro is running from workbook 1.

I'm guessing a change in the last line. I don't know what Dim means either.

Dim FName As String
Dim FPath As String

FPath = "G:"
FName = Sheets("sheet 1").Range("A1").Text
ThisWorkbook.SaveAs Filename:=FPath & "" & FName

View 1 Replies View Related

Automatically Produce Save As File Name By Value In A Cell

Mar 21, 2009

I would like excel to automatically suggest the save as file name and location for my workbook when I click the save, save as or close options. The file name should be a combination of values in cells A1 and A2 of Sheet1. The location should be a folder named "Bill" in C:/My Documents. I think I can do it with a beforesave code but I am new to vba.

View 13 Replies View Related

Automatically Save File Name From Cell Data

Jul 22, 2013

How to click a button to automatically combine a few cell data and save it as the file name ?

The file name i want to save, is in this method.

( Date 2013-07-22 ) + ( Cheque No UOB000000 ) + ( ReceiverName ) + ( InvoiceNo L123456 ) + ( Payment Voucher Code ) + ( Amounts $1111111 )
______V5___________________E17___________________D11________________O9______________Add word ( PV )_____________W16

Sample File name : 2013-07-22_UOB000000_TransAuto_Inv778899_PV_$$$$$$$

I tried to add this code : FName = ActiveWorkbook.Sheets("Payment Voucher").Range =("V5&"_"&E17&"_"&D11&"-"&O9&"_"&"PV"&"_"&W16")

But getting error.

Than i tried to group all the cell data into cell (E11) and than select as range (E11), but when i tried to group it, the beginning the file name instead of i want it to be the date 2013-07-22_UOB........ it become 41113_UOB............

View 5 Replies View Related

Automatically Save/List Cell Value Every X Minutes

May 28, 2008

I have a range that refer to an external data. This external data is refreshed every one minute. So the data is changing every one minute. I need to copy the content of one fix cell in that range into another cell every one minute, each time copy to a different cell. Example: cell A1 has the content that refer to an external data. Cell A1 is updated every one minute. At first A1= 100, I need it to be copied to cell B1 (so B1=100); one minute later, A1=101, I need it to be copied to B2 (so B2=101) and so on.

View 4 Replies View Related

Macro To Save XLSM In Defined Path With Year Day And Month Changed

Jan 31, 2014

I need to save a document in the following path: [URL] .......

Only the year month and day sould change when I hit the save button/macro: 2014_01_29

How to build a macro that would save my file as per my above explanation??

If I would run the macro today the excel file should be saved in the path: [URL] .......

View 1 Replies View Related

Trying To Copy Changed Cells In A Workbook To Another Workbook?

Mar 14, 2014

What I am trying to do is when data is changed in a workbook, I would like to be able to have it automatically copy the changes to another workbook.

View 2 Replies View Related

Excel 2013 :: All Sheets Being Automatically Changed To Currency Format

Dec 2, 2013

We have 3 PCs, all running MS Office 2013. On 1 of these machines, it is doing strange things with formatting. If you open a document or try to paste anything into certain documents, it decides everything is currency format and assigns all sorts of wrong formatting to the entire sheet, or the entire document. There may be some cells in the doc that are indeed currency, but only a small proprtion. If I open a new, fresh document and paste into that document, it does not do this, it seems to work normally, only applying currency formatting where it might be applicable. On some larger docs that have this issue, no matter what I do, it just continues to apply these strange settings.

View 2 Replies View Related

Automatically Updating Adjacent Cells Based On Dropdown List Selection Even If Changed

Apr 12, 2013

I have a workbook that has two worksheets. One worksheet is an input worksheet. A user will select a date from a drop-down list and type in the events that occurred on that date in 8 adjacent cells. The user selects a button that advances date and clears form. On sheet 2, whatever was typed into sheet one is saved via VLOOKUP formula. However, if I try to change something retroactively and select a previous date from the drop-down list, it clears everything in sheet 2 that was typed for any selected day.

View 1 Replies View Related

Save Workbook As Cell Value

Sep 17, 2008

I am trying to save a workbook created by another macro using the value or text from cell A6. I get a runtime error of 1004: Method 'SaveAs' of object'_workbook' failed. Here is the code that I have.

Sub SaveAs()
Dim FName As String
Dim FPath As String
FName = ActiveWorkbook. Sheets("Sheet2").Range("A6").Text
FPath = "c:ISSignup"
ActiveWorkbook.SaveAs Filename:=FPath & "" & FName & ".xls", _
FileFormat:=xlNormal, CreateBackup:=False

View 3 Replies View Related

Macro To Save Workbook By Referencing Cell In Another Workbook For File Name And File Path

Mar 21, 2013

I have got a master workbook and I have written macro to copy and paste data on another workbook. write a macro to save the new workbook to a file path with a file name where both file name and path are stored in master workbook sheet...

View 5 Replies View Related

Save Workbook As Cell Text

Jan 15, 2009

Have read a few codes that allow you to automatically save a workbook using the value of a cell as the name of the file.

BUT, I can not find the code to save it if the cell is a date.

The 17/01/2009 wont save due to the forward slash.

Is there anyway within code that I can save the workbook by first removing the slashes?

View 9 Replies View Related

Update Workbook Name In Cell After Save As

Jun 6, 2007

I have a cell which uses part of the name of the workbook. This name is updated everytime I activate the sheet with this code (in the worksheet code section):

Private Sub Worksheet_Activate()
Range("Workbook_Name").Value = ""
If Mid( ActiveWorkbook.Name, 34, 1) > "" Then
Range("Workbook_Name").Value = Mid(ActiveWorkbook.Name, 23, 12)
End If
End Sub

Workbook_Name is a named range for the cell in which I want the truncated portion of the file name to appear.

Is there anyway to trigger an update using vba with the SaveAs event?

View 9 Replies View Related

Create New Workbook And Save Filename From Cell Value

Nov 1, 2009

Im trying to create a macro that when i click the button a new workbook is created and saved as the value from C5 cell.

View 9 Replies View Related

Workbook Save, Make Sure Active Cell Is A1

Jun 10, 2006

When saving a file that has 5 sheets that extend to the right of the users screen, sometimes the left part of the report is left somewhat hidden because the last person to save it was using the part to the far right. Is there a way to move all the active cell to A1 and make sure rows A:D or so are showing?

View 4 Replies View Related

Copyrights 2005-15, All rights reserved