ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Automating change via popup to a column of numbers (https://www.excelbanter.com/excel-worksheet-functions/232238-automating-change-via-popup-column-numbers.html)

Colin Hayes

Automating change via popup to a column of numbers
 


Hi All

Don Guillett kindly made some code to change the content of a column of
numbers :


Sub Add_Subtract_Multiply_Divide_Selected_Column()

Selection.NumberFormat = "0.00"
Dim mc, lr As Long
Dim row1value, dowhat, x As String
mc = ActiveCell.Column
lr = Cells(Rows.Count, mc).End(xlUp).Row
If lr = 1 Then Exit Sub
'row1value = Cells(1, mc)
'Cells(1, mc) = InputBox("Vary Number By How Much?")
dowhat = InputBox("A to Add, D to Divide, M to Multiply, S to Subtract",
"Price Variation")
Select Case UCase(dowhat)
Case "A": x = xlAdd
Case "D": x = xlDivide
Case "M": x = xlMultiply
Case "S": x = xlSubtract
Case Else
MsgBox "Not a choice - Please Try Again."
Exit Sub
End Select
row1value = Cells(1, mc)
Cells(1, mc) = InputBox("Vary Number By How Much?", "Price Variation")
Cells(1, mc).Copy
Range(Cells(2, mc), Cells(lr, mc)).PasteSpecial _
Paste:=xlPasteAll, Operation:=x
Application.CutCopyMode = False
Cells(1, mc) = row1value

Selection.NumberFormat = "0.00"
'
End Sub



I need this to have a popup to request a value below which the
calculation will not go.

For example , having entered the operator into the first popups , I need
an extra one asking me for a lower limit. If I entered say 3.50 into
this popup then the calculation would not later below this number.

Example - before

3
3.5
4
4.5
5
5.5
6
6.5

Popup to subtract 2.5 , but with a lower limit of 3

After

3
3
3
3
3
3
3.5
4


Gratfeul fo any assistance.



Best Wishes


Colin


All times are GMT +1. The time now is 12:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com