How Does This Code Need To Be Changed
Oct 2, 2008
I have created a userform with multi pages... One of the page is up and running ok.
However I have on one page entries like customer number, name, address, and so on.
I have the same userform from a book which I like to use in one of my pages.
Now what I have problems with is that I need one page to refer to another worksheet of the workbook.
Lets say first page to one worksheet the second page to another. And so on.
Here is the code from the book and it likes to refer to the same worksheet as the userform is opening up.
Private Sub frmDFG_Initialize()
'Startzeile für das Drehfeld festlegen
If .ActiveCell.Row < 3 Then
spn_Change = 3
Else
spn_Change = ActiveCell.Row
End If
End Sub
View 9 Replies
ADVERTISEMENT
Aug 18, 2014
I have this VBA code running in cell A1 which gives you a yes/no message box when you try to change the selected cell. I am trying to have the Target.Address = 'Specific Header Cell in Table' but I am not able to develop the code to do so. Here is the code:
[Code] .....
The main reason I have this message box is to prevent the user from changing the cell in the table because the titles in the tables are linked to macros. If they are changed, the macros will not run. Also, I am aware there are codenames for the excel sheets in a workbook. If there are codenames for the header titles in an excel table, I could link my macros to the codenames. As a result, I would not need this macro for the message box.
View 2 Replies
View Related
Feb 26, 2014
I've managed to piece together a VBA code that works perfectly for my needs. The problem is that the sheet it is on gets adjusted a lot, and I only need the code to run when certain cells are changed (rather than each time any cell is changed).
Here is the code I have now:
[Code] .....
Put simply, I need this code to run only when a cell in Range "TValueDeal" is changed. Is making this adjustment as simple as adding a couple lines of code, or is there a better way to write the entire thing?
View 3 Replies
View Related
Aug 23, 2002
Is there a way to cause a particular VB function I write to execute any time a value in a particular range of cells is changed?
I thought I had it when I thought I could do a sum formula, range on the cells to be checked, then call the function as a side effect of this sum. It was then that I realized I didn't know how to call VB from within an Excel cell formula.
1. Is there a way to call VB (say, sheet1.myFunction())?
2. Is there a better way to do what I want than to try to hack a side effect into a formula in a cell that depends on a sum (which "watches" for the changes for me.)
The cells would have text in them, not numbers, so using the sum-based formula would be iffy at runtime to me at best. What I really want to do is run a function on the cell value as a string. There are a lot of such cells (thousands) so ideally I would only need one external cell to activate the function (which scans all the cells I am concerned with) rather than have to paste a custom, relative formula into thousands of cells manually to have each one watch one cell, if you know what I mean.
View 9 Replies
View Related
Jan 21, 2014
I wrote the following basic code earlier (which will end up being part of a larger code)
Code:
Dim DateInput As String
Dim LastCell As String
Sub LastRowInputBox()
LastCell = InputBox("What is the last row number in the range?", "Last Row Input")
[Code] ......
As you can see, all the ColumnCopyInsert Subroutine does is copy select/copy four columns (E:H), inserts the copied selection immediately to the right, inserts formulas and autofills down to the last row required. I added the LastRowInputBox routine as the range of rows varies from week to week (inserting new rows, deleting others).
The code works great...up to a point unfortunately. If ran as it is, everything that should be copied/pasted will be and cells autofilled to the row specified via the InputBox. Here comes the problem, if any rows are either inserted or deleted then the code throws out "The object invoked has disconnected from its clients" when it reaches the first instance of the following line:
Code:
Selection.Insert Shift:=xlToRight
At which point, Excel hangs (or maybe in some sort of loop) and I have to open Device Manager and close the Excel exe process.
View 5 Replies
View Related
Apr 15, 2008
I used the code below for Conditional Formatting. This works fine but the VBA-code crashes when I delete more than one selected cell. Is there a simple modification possible to prevent this from happening?
Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Integer
If Not Intersect(Target, Range("A1:C250")) Is Nothing Then
Select Case Target
Case 1
icolor = 6
Case 2
icolor = 12
Case 3
icolor = 7
Case 4
icolor = 53
Case 5
icolor = 15
Case 6
icolor = 42
Case Else
'Whatever
End Select
Target.Interior.ColorIndex = icolor
End If
End Sub
View 3 Replies
View Related
Jun 10, 2009
I asked for a macro to delete the whole row if a duplicate customer number was found in column B. Sometimes, though, my column numbers change. So, logically thinking, I simply changed the criteria, but the macro ONLY seems to work if duplicate customer numbers are in column B only.
This code below won't work if the Customer Number is in column D instead of B even if the reference of B:B is changed to D:D, it doesn't carry the macro over.?
View 3 Replies
View Related
Apr 24, 2007
I have a forecast spreadsheet with 10 data tabs and a summary tab.
On the summary tab, cell R131 contains the year end profit figure.
What I would like to do, is whenever this value changes and I am in a different tab, a small pop up appears in the current tab telling me what the R131 value has changed by. eg "Profit up £1000"
At the moment I keep having to go back to the summary tab to see the effects of changes across the whole spreadsheet.
View 9 Replies
View Related
Dec 30, 2009
If the value of any cell in in column D is changed to "Closed", a message box will appear that says "Others must be notified when item is closed". In that message box, I want two buttons: Button 1 One is cancel and will undo the change. Button 2 will open MS Outlook with pre-filled email addresses and will attach the open worksheet. After the email is sent, to return to Excel.
View 4 Replies
View Related
Jan 1, 2010
when the name changed and sum changed.
View 9 Replies
View Related
Jul 26, 2007
I have the following code on my worksheet.
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("B2")) Is Nothing Then
Do_it
End If
End Sub
Cell B2 contains an employee number. What I need to do is save some data for the employee number that was in cell B2 just before it was changed.
Example: If employee number "10" is entered in B2.
Then the user were to change the employee number in cell B2 to "55" I would like to use the previous value "10" to do some VBA stuff with.
View 5 Replies
View Related
Oct 30, 2008
Excel has went from using the backslash to using a hyphen. If I try to format the cell, all the date choices use the hyphen, what possibly changed?
View 3 Replies
View Related
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
Dec 3, 2013
existing workbook that has evolved over several years, there are bits of data spread all over the sheets and there are several sheets.
My question is. Is there a way to show/print/email an alert with a reminder message any time any of the formula cells gets changed, something like "Be aware a formula is being changed, make a note of the changes."
View 8 Replies
View Related
Feb 19, 2009
In my spreadsheet I have column B which has a drop down list using "open" and "closed" as the choices. Whenever someone selects the closed option, I would like for that row to be moved to the next blank row on the tab called CLOSED. Is this possible? I was thinking that if it was it would require some kind of coding. I have attached my spreadsheet for you to look at.
View 2 Replies
View Related
Jun 23, 2009
I chose to place this in programming, as all the functions for this workbook are either macros or Internet Links. Nothing is ever changed on the worksheet.
I have a workbook that is fully protected with passwords both for the workbook and the worksheet. When I set up the protection, no check boxes are checked.
I have macros and internet links on the worksheet that can be selected, but none of them affect the worksheet.
As a matter of fact, I can open the workbook and close it with only "Application.Quit" in a macro and a message box comes up asking if I want to save the changes or not. If I close it with the upper right corner RED X, it still asks the question.
I have no "On Open Macros" or Links of any kind.
I have other workbooks that this does not happen on.
View 10 Replies
View Related
Jun 28, 2009
This is the first VBA project i've done on Excel, and its not very big. I've never done any programming before, but i need help on this
What i'm trying to do it to have the Combo box that when an item is selected the respective picture shows next to it (i've got a seperate sheet with the products, prices, pics etc...)
After trying everything to get the picture to show, i switched to VBA because it looked like i could do it in that. The first thing i did was record a macro for each picture - the first one goes like this (its called TEST)
View 10 Replies
View Related
Jan 6, 2014
When I move the range rDes, another range rOrig with the same address gets changed. How can I prevent this?
Code:
Sub Macro1()
Dim rSrc As Range
Dim rDes As Range
Dim rOrig As Range
Set rOrig = Selection
[Code] ........
View 3 Replies
View Related
Mar 23, 2007
the dates in my spreadsheet changed from dd-mm-yyyy to a random 5 digit number. For instance, if I enter in 01-07-2007, it will re format to to 39089. I am trying to fix it, but I can't seem to figure out what happened and how to get all of the dates back to normal. Is there a way to fix this?
View 9 Replies
View Related
Jan 16, 2008
Can you protect a sheet name from being changed by a user?
Can you protect a sheet from being deleted by a user?
I have an Excel 2003 file available to all employees on a network. There are three sheets. Two sheets are protected with passwords and users can not enter any data on them. They are used to hold data needed by the third sheet.
The third sheet (named FORM) is for user input. FORM has a majority of the cells protected with a password. Users can enter information, save the file, print the sheet, or make duplicates of the sheet. The sheet contains data validations, conditional formatting, and formulas.
I have some VBA which acts on all the sheets (even those which users might have inserted) making them visible (very hidden) or not. When a user opens the file (whether for the first time or after adding sheets), I always want them to have FORM unhidden. I have VBA to do this but what if a user changes the name of the sheet? CRASH!
View 9 Replies
View Related
Feb 27, 2009
Is it possible to have a macro run when a date is changed each month instead of clicking on the button. I have a few macros that are ran each month in a spreadsheet (manually) but would I would like to have them run automatically when the date is changed in cell a4 each month (Cell A4 is linked to another spreadsheet tited "Input" here the date is changed each month and all of the other spreadsheets are automatically updated). The date in cell a4 is always the last day of the month. Also the name of the workbook changes each month ( I am not sure if this is important to know).
View 9 Replies
View Related
Apr 6, 2009
I'm looking to display a message if data in the active cell is changed. I'm using the code below to check if data in a cell matches certain criteria:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Column = 9 Then
ThisRow = Target.Row
If Target.Value Like "As*" Then
MsgBox "Please add a note about why the biology of this species is distinct the Comments column."
End If
End If
But I have another column where the cells are prefilled with data. This column stores data from a dropdown, such as Critically Endangered, Endangered, Vulnerable etc. I allow the user to change the data in these cells, by selecting an alternative value from the dropdown, but I want to display a message if they change the data in one of these cells.
View 9 Replies
View Related
Sep 30, 2009
The userform takes the data to a worksheet, then i run a pivot table on the worksheet to provide an easy to view summary of entries....
I'd like the user to be able to amend a record if they see an error ... so from the userform how do i do that ? I've read a bit about refedit ( completely ) and a bit about Find...
View 9 Replies
View Related
Oct 28, 2009
I use Excel 2003. With a LOT of help from this board, I've written some macros for a workbook template that will be opened then saved with another name with an .xls extension. The problem is that the macros transfer data to and from another workbook template. Here's the code that's giving me problems.
Windows("BookA.xlt").Activate
Sheets("Sheet1").Select
ActiveWorkbook.Save
Range("A1").Select
Application.CutCopyMode = False
Selection.Copy
Windows("BookB.xlt").Activate
How can I use the macro if I open BookA.xlt then change the name to BookZ.xls for my data entries? At the same time BookZ is open, I may use another instance of BookA.xlt and save that one as BookY.xls. What's the most feasible way to still use the macros?
View 9 Replies
View Related
Nov 4, 2009
I have a userform with many command buttons, one of which allows the user to input a date into a textbox via a pop-up calendar.
Everything works, except the fact that I would like to have the textbox display in the format: Wednesday, November 4, 2009 instead of the format produced by the calendar, which is 11/4/2009.
Does anyone know how to change the value of the output from the calendar?
Here's the code I'm using now:
Scheduler.PubDateBox.Value = Calendar1.Value
View 9 Replies
View Related
Dec 19, 2006
I have a form in a workbook that has macros attached via buttons. The intention is that as you hit the revise button it creates a virtually identical sheet, renaming it as a copy in the same workbook, clearing certain fields...etc...I then have it "lock/protect" the previous revision sheet so the history can't easily be corrupted. Everything works with the exception of the forms textbox...it won't lock (more to the point I can't figure out how to lock it). Can you protect a forms textbox even?
View 2 Replies
View Related
Mar 13, 2007
I have a text file which have a column with data like xxx . however, when I open the file with excel and it displayed incorrect value like xx.xxx, x.xxx
I tried to change the format cell to text, but it still cannot display original data...
View 9 Replies
View Related
Apr 29, 2007
when I tried to input numbers into an Excel spreadsheet (Excel 2003) the numbers were entered as decimals. Example: I type in 235 with NO decimal point, Excel enters it as 2.35, even when starting from scratch, using a new sheet or new workbook. I tried using format cell from the menu bar to choose "general" then as "number". Nothing changed. I also tried to set the decimal places at "0" using the number format. All that did was truncate the number to 2 with the .35 not being displayed in the cell. It IS displayed in the formula window as 2.35... but not as I entered it... 235. This happens no matter whether or not it's a brand new blank workbook or worksheet
View 2 Replies
View Related
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
Else
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
Jan 17, 2014
I have in the attached file four variables, with their values in B3:B6, and the results of applying a formula to them in B8.
How to determine which value variable C must be changed to so that the formula returns the result in B10?
Solution.xlsx‎
View 4 Replies
View Related