ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Assistance with code (https://www.excelbanter.com/excel-programming/425053-assistance-code.html)

JMay

Assistance with code
 
I've currently using the following

Range("Q1").Copy 'my cell Q1 contains the Value 2
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlMultiply, _
SkipBlanks:=False, Transpose:=False

But I would like to include the VAlue 2 in this code (away from Spredsheet)

I'de like to use a normal Variable like
MyMult = 2 ' I obviously need to get MyMult into the CLIPBOARD, but How??

How would I change the above code to accomidate the MyMult

Mike Fogleman[_2_]

Assistance with code
 
I am not sure you can do this without the worksheet being used. You can
assign an unused cell the value of 2, do your pastespecial multiply, then
clearcontents on the cell with the temporary 2 in it.

Range("Q1").Value = 2
Range("Q1").Copy
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlMultiply, _
SkipBlanks:=False, Transpose:=False
Range("Q1").ClearContents

Mike F

"JMay" wrote in message
...
I've currently using the following

Range("Q1").Copy 'my cell Q1 contains the Value 2
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlMultiply, _
SkipBlanks:=False, Transpose:=False

But I would like to include the VAlue 2 in this code (away from
Spredsheet)

I'de like to use a normal Variable like
MyMult = 2 ' I obviously need to get MyMult into the CLIPBOARD, but
How??

How would I change the above code to accomidate the MyMult




JLGWhiz

Assistance with code
 
If you use the variable to store the value 2, then you do not need to copy
anything to use that value anywhere on the worksheet. i.e. you can use code
like:

ActiveSheet.Range("b10") = myMult

or you and use:

ActiveSheet.Range("B10") = Sheets(2).Range("A6")*myMult

The clipboard is not essential for using the value stored in the variable.

"JMay" wrote:

I've currently using the following

Range("Q1").Copy 'my cell Q1 contains the Value 2
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlMultiply, _
SkipBlanks:=False, Transpose:=False

But I would like to include the VAlue 2 in this code (away from Spredsheet)

I'de like to use a normal Variable like
MyMult = 2 ' I obviously need to get MyMult into the CLIPBOARD, but How??

How would I change the above code to accomidate the MyMult



All times are GMT +1. The time now is 08:36 AM.

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