macro to multiply cell by 1000

Trebormac

New Member
Joined
Sep 10, 2009
Messages
32
I have a macro to copy a cell value from one workbook and paste special value into a cell in another workbook. I want to add some functionality to the macro to multiply the pasted cell value by 1,000.

I can not seem to duplicate the key strokes I would use to do this mannualy in the worksheet. In other words what would be the code to:

F2 (edit cell mode)
Home key (move to the front of the value, use only if cell vaalue not negative)
+key (if not negative)
end key (move to end of value)
* (multiplication sign)
1000
enter

If I use the macro recorder I end up with the same cell value every time.

Any help would be appreciated

Trebormac
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Are you saying that it must be a formula, rather than a value?
 
Upvote 0
Try:

Code:
Sub Test()
    With ActiveCell
        If .HasFormula Then
            .Formula = .Formula & "*1000"
        Else
            .Formula = "=" & .Formula & "*1000"
        End If
    End With
End Sub
 
Upvote 0
Thanks Guys...I gues I was not to clear in my request. In the mean time I scatched my head a little harder and came up with the solution:

ActiveCell.Value = ActiveCell.value * 1000

Thanks again,

Trebormac
 
Upvote 0

Forum statistics

Threads
1,214,830
Messages
6,121,834
Members
449,051
Latest member
excelquestion515

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