If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#2
|
|||
|
|||
Visual Basic....Calculate Button
Something like this should help and you will need NO buttons of any kind.
Right click on the sheet tabview codecopy/paste this.Modify to suit. As written, any number entry in column D which is column 4 will add 3 to the number in col f. Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column 4 Then Exit Sub On Error GoTo doagain Cells(Target.Row, "f") = Target + 3 doagain: MsgBox "error-Enter a number" Exit Sub End Sub -- Don Guillett SalesAid Software "sowetoddid " wrote in message ... Another question... How would I designate which cells to calculate, using this command? I am not too familiar with manipulating this formula. x=activecell.row cells(x,"n")=whatever This is my attempt... Sub EnterFormula() Worksheets("GasEvents").Range("N41").Formula="=Rel easeWorksheet!H26" End Sub (repeated for each cell in the row 41) If I am doing that corrects, it would still cause the formula to stay in the cells...which would cause the values of 41 to change each time new data is entered for row 42, 43, etc. I want row 41 to maintain it values even after new data is inputted for row 42, 43, etc. --- Message posted from http://www.ExcelForum.com/ |
#3
|
|||
|
|||
Visual Basic....Calculate Button
Oops.. Forgot a line
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column 4 Then Exit Sub On Error GoTo doagain Cells(Target.Row, "f") = Target + 3 end doagain: MsgBox "error" Exit Sub End Sub -- Don Guillett SalesAid Software "sowetoddid " wrote in message ... Another question... How would I designate which cells to calculate, using this command? I am not too familiar with manipulating this formula. x=activecell.row cells(x,"n")=whatever This is my attempt... Sub EnterFormula() Worksheets("GasEvents").Range("N41").Formula="=Rel easeWorksheet!H26" End Sub (repeated for each cell in the row 41) If I am doing that corrects, it would still cause the formula to stay in the cells...which would cause the values of 41 to change each time new data is entered for row 42, 43, etc. I want row 41 to maintain it values even after new data is inputted for row 42, 43, etc. --- Message posted from http://www.ExcelForum.com/ |
#4
|
|||
|
|||
Visual Basic....Calculate Button
If I understand correctly, just remove the +3 from target+3.....
You may send me a SMALL example workbook to the address below and I will take a look. -- Don Guillett SalesAid Software "sowetoddid " wrote in message ... Thanks, Don! Unfortunately, I am not yet advanced in visual basic code. So, can you help me to come up with the actual code that I would use, based on my sample eqtns. Looking at the code you gave me... The points cells in column 'D' are inputted with values while at the same time column 'F' adds three to each value and places them in column 'F'. My situation is similar but I would only use cell D1, for example. I would input the value 5 into D1 and want F1 to be populated with 5. At a later time I would input 9 into D1 and want F2 to be populated with 9. Also, I may choose input a 4 into D1 and want F1 to be updated to this number. D1 = 5 --- F1 = 5 D1 = 9 --- F2 = 9 If I made a mistake, I would want to go back and do D1 = 4 --- F1 = 4 That is why it seems a calculate button would be the way to go. Thanks! --- Message posted from http://www.ExcelForum.com/ |
Thread Tools | |
Display Modes | |
|
|