Please help, I've been working on this for days

  • Thread starter Thread starter Nikkih
  • Start date Start date
N

Nikkih

Hello, I've been working on this since this past weekend and I can'
figure it out.

I basically want the user to be able to select one column that the
want, and multiply each number in that column by another number (t
increase it by a certain percentage) and then place those new value
into a new column that the user specifies. The column could b
different; it won't always be the same column, which is the problem.
Please help me
 
This is what I have so far
Dim firstRange As Range
Dim secRange As Range
Dim percentage As Integer
Dim numCols As Integer
On Error Resume Next

Set firstRange = Application.InputBox(Prompt:="Input", Title:="DAT
RANGE", Type:=8)
percentage = Application.InputBox("Enter a %")
Set secRange = Application.InputBox(Prompt:="Output", Title:="DAT
RANGE", Type:=8
 
Hi Nikkih,

You can use a formula
=A1 * 1.15

you can type 1.15 into a cell and copy it (Ctrl+C)
then select the cells to be changed
Edit, Paste special, multiply

Suggest trying this on a copy of your worksheet first
to make sure you get the hang of it.

Frank Kabel must be asleep, or traveling from work to home,
I got in at least 3 replies here in his absence. <grin>
 
Dim rng As Range
Dim c As Range
Dim myarray() As Double
Dim num As Integer
Const Timesnumber As Double = 100
On Error Resume Next
Application.DisplayAlerts = False
Set rng = Application.InputBox("Select a range"
&_ "with the mouse", Type:=8)
Application.DisplayAlerts = True
On Error GoTo 0
If rng Is Nothing Then
MsgBox "You Press cancel"
Exit Sub
End If
If Selection.Columns.Count <> 1 Then
MsgBox "you must have one column selected"
Exit Sub
End If
If rng.Columns.Count <> 1 Then
MsgBox "you selected more then one column in the
destination range"
Exit Sub
End If
On Error Resume Next
num = 1

For Each c In Selection
If num = 1 Then
ReDim myarray(1 To num)
Else
ReDim Preserve myarray(1 To num)
End If
nyarray(num) = Timesnumber * c.Value
num = num + 1
Next
num = 1
For Each c In rng
c.Value = myarray(num)
num = num + 1
Next num

part of this code comes from rons a few post down
 
thier was 2 errors in code pasted above

in the first for each change the nyrange to myrange
in the second for each get rid of the num after next

sorry typing to fast
 
How do I put the new values into a different column? The column coul
be anywhere on the page (the user would select the column)
thank
 

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

Back
Top