MsgBox change value

Carscomp

New Member
Joined
Oct 21, 2014
Messages
10
Is it possible to change the a cell value using a msgbox?
A macro runs and asks user if the quantity in cell is correct.
If user says no, it will point to a new macro to change cell value.
But it does not work.
The cell with which the qty is in will constantly change as the main macro pulls data.
I have search internet and forums. Could not find a solution to help.


Sub InputBox_Display1()
'Input Box display options - refer Images 1a & 1b

Dim answer As Integer

Inputbox "Enter New Number"


'Imputbox "Enter New qty"
'Activecell.Activate
'Activecell = valuechange
'Activecell.Value = Inputbox.Value

' Activecell.Value
'ImputBox = Value




End Sub
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
You would use an InputBox, not a MsgBox to prompt for and take in a value to use to update a cell.

If you explain (in detail, not in general terms) exactly how you workbook is structured and how you would like this to work, I am sure someone here can help you come up with the code that you need.
It can all be done in a single macro (probably doesn't require two).
 
Upvote 0
Here is the code that is bringing the data from the oracle table.
Images below show the spread sheet format with yes and no message box.
If yes is clicked then it goes to the next line and returns the data for the row based on the number in column B.
If no is clicked then is has a message box asking you to change to the correct qty column D.
But I cannot get the new value to populate.

Sub Returns()


'Declare variables as objects

Dim OraAdapter As OraAdapter '64bit
Dim OraDatabase As Object
Dim Oradynaset As Object
Dim flds() As Object
Dim fldcount As Integer
Dim answer As Integer



Set OraDatabase = NewOraAdapter '64bit
OraDatabase.OpenDatabase "****", "***/****" '64bit


Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Application.EnableEvents = True

[B4].Select
Do While Activecell <> ""

partno = Activecell
q = [A1].Comment.Text
q = WorksheetFunction.Substitute(q, ":partno", partno)
Set Oradynaset = OraDatabase.CreateDynaset(q, 0&)

x = Oradynaset.RecordCount
y = Oradynaset.Fields.Count - 1
Oradynaset.MoveFirst
' Range([A3], [A3].Offset(1000, y)).ClearContents


Do While Not Oradynaset.EOF
For Z = 0 To y
datatypes = [A3].Offset(0, Z + 1).NumberFormat
Activecell.Offset(RowCount, Z + 1).NumberFormat = datatypes
Activecell.Offset(RowCount, Z + 1).Value = Oradynaset.Fields(Z).Value
Next Z
' rowcount = rowcount + 1



Oradynaset.MoveNext
Loop

answer = msgBox("Qty Correct?", vbQuestion + vbYesNo)






If answer = vbNo Then
Activecell.Offset(0, 2).Select
Call InputBox_Display1
'answer = MsgBox("Change Qty to")
Activecell.Offset(1, -2).Select
Else
Activecell.Offset(1, 0).Select
'answer = MsgBox("enter correct Qty")

End If


Loop

[A4].Select

'Application.Calculation = xlCalculationAutomatic
'Application.ScreenUpdating = True
Application.EnableEvents = True



End Sub
 

Attachments

  • Returns.JPG
    Returns.JPG
    64.8 KB · Views: 25
  • Returns2.JPG
    Returns2.JPG
    60.3 KB · Views: 21
Upvote 0
No where in your code are you setting anything equal to anything.
You are selecting cells, but no changing any values.

Here is an example of using an InputBox to change the value:
VBA Code:
Dim newVal as Double
newVal = InputBox("Enter New Number")
Cells(ActiveCell.Row, "D").Value = newVal
this will set the value of column D in the active row to the new value you just entered in.
 
Upvote 0
Solution
You are welcome!
Glad I was able to help.
 
Upvote 0

Forum statistics

Threads
1,224,115
Messages
6,176,463
Members
452,728
Latest member
mihael546

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top