Replace a fixed number with a variable via popup

C

Colin Hayes

Hi All

In the code below , can somebody suggest how to replace the fixed
multiplication by 1.4 with a variable inserted via popup?


Columns("N:N").Select
Selection.Insert Shift:=xlToRight
Range("N2").Select
ActiveCell.FormulaR1C1 = "=RC[-1]*1.4"
Columns("N:N").Select
Selection.NumberFormat = "0.00"
Range("N2").Select
Selection.AutoFill Destination:=Range("N2:N" & lrow),
Type:=xlFillDefault
Range("N2:N" & lrow).Select
Range("M1").Select
Selection.Cut Destination:=Range("N1")
Columns("N:N").Select
Selection.Copy
Columns("M:M").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Columns("M:M").Select
Application.CutCopyMode = False
Selection.NumberFormat = "0.00"
Columns("N:N").Select
Selection.Delete Shift:=xlToLeft


Grateful for any advice.



Best Wishes
 
G

Gord

Dim num As Long
num = InputBox("enter a number")

ActiveCell.FormulaR1C1 = "=RC[-1]*" & num


Gord Dibben Microsoft Excel MVP
 
C

Colin Hayes

Gord said:
Dim num As Long
num = InputBox("enter a number")

ActiveCell.FormulaR1C1 = "=RC[-1]*" & num


HI Gord

OK that's perfect. Thanks for your help.



Best Wishes ,



Gord Dibben Microsoft Excel MVP

Hi All

In the code below , can somebody suggest how to replace the fixed
multiplication by 1.4 with a variable inserted via popup?


Columns("N:N").Select
Selection.Insert Shift:=xlToRight
Range("N2").Select
ActiveCell.FormulaR1C1 = "=RC[-1]*1.4"
Columns("N:N").Select
Selection.NumberFormat = "0.00"
Range("N2").Select
Selection.AutoFill Destination:=Range("N2:N" & lrow),
Type:=xlFillDefault
Range("N2:N" & lrow).Select
Range("M1").Select
Selection.Cut Destination:=Range("N1")
Columns("N:N").Select
Selection.Copy
Columns("M:M").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Columns("M:M").Select
Application.CutCopyMode = False
Selection.NumberFormat = "0.00"
Columns("N:N").Select
Selection.Delete Shift:=xlToLeft


Grateful for any advice.



Best Wishes
 
G

Gord

Happy to assist.

Gord

Gord said:
Dim num As Long
num = InputBox("enter a number")

ActiveCell.FormulaR1C1 = "=RC[-1]*" & num


HI Gord

OK that's perfect. Thanks for your help.



Best Wishes ,



Gord Dibben Microsoft Excel MVP

Hi All

In the code below , can somebody suggest how to replace the fixed
multiplication by 1.4 with a variable inserted via popup?


Columns("N:N").Select
Selection.Insert Shift:=xlToRight
Range("N2").Select
ActiveCell.FormulaR1C1 = "=RC[-1]*1.4"
Columns("N:N").Select
Selection.NumberFormat = "0.00"
Range("N2").Select
Selection.AutoFill Destination:=Range("N2:N" & lrow),
Type:=xlFillDefault
Range("N2:N" & lrow).Select
Range("M1").Select
Selection.Cut Destination:=Range("N1")
Columns("N:N").Select
Selection.Copy
Columns("M:M").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Columns("M:M").Select
Application.CutCopyMode = False
Selection.NumberFormat = "0.00"
Columns("N:N").Select
Selection.Delete Shift:=xlToLeft


Grateful for any advice.



Best Wishes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top