ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Please help, I've been working on this for days (https://www.excelbanter.com/excel-programming/296743-please-help-ive-been-working-days.html)

Nikkih

Please help, I've been working on this for days
 
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

--
Message posted from http://www.ExcelForum.com


Nikkih[_2_]

Please help, I've been working on this for days
 
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

--
Message posted from http://www.ExcelForum.com


david mcritchie

Please help, I've been working on this for days
 
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
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Nikkih " wrote in message ...
Hello, I've been working on this since this past weekend and I can't
figure it out.

I basically want the user to be able to select one column that they
want, and multiply each number in that column by another number (to
increase it by a certain percentage) and then place those new values
into a new column that the user specifies. The column could be
different; it won't always be the same column, which is the problem.
Please help me!




steve

Please help, I've been working on this for days
 
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

-----Original Message-----
Hello, I've been working on this since this past weekend

and I can't
figure it out.

I basically want the user to be able to select one

column that they
want, and multiply each number in that column by another

number (to
increase it by a certain percentage) and then place

those new values
into a new column that the user specifies. The column

could be
different; it won't always be the same column, which is

the problem.
Please help me!


---
Message posted from http://www.ExcelForum.com/

.


steve

Please help, I've been working on this for days
 
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


-----Original Message-----
Hello, I've been working on this since this past weekend

and I can't
figure it out.

I basically want the user to be able to select one

column that they
want, and multiply each number in that column by another

number (to
increase it by a certain percentage) and then place

those new values
into a new column that the user specifies. The column

could be
different; it won't always be the same column, which is

the problem.
Please help me!


---
Message posted from http://www.ExcelForum.com/

.


Nikkih[_3_]

Please help, I've been working on this for days
 
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

--
Message posted from http://www.ExcelForum.com


david mcritchie

Please help, I've been working on this for days
 
Don't either of my suggestions fit work?

Both will work on constants or formulas.

If you use a macro, I'd work on a selection, and
you usually work on the value so formulas would be
wiped out. Some things to look for in a macro see
http://www.mvps.org/dmcritchie/excel/proper.htm
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Nikkih " wrote in message ...
How do I put the new values into a different column? The column could
be anywhere on the page (the user would select the column)
thanks


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 04:07 AM.

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