ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Creating Range in VBA Code and using Pastespecial (https://www.excelbanter.com/excel-programming/421275-re-creating-range-vba-code-using-pastespecial.html)

Per Jessen

Creating Range in VBA Code and using Pastespecial
 
Hi

Maybe this will help you:

Dim TargetCell As String
TargetCell = "A1" ' change to suit
Range(TargetCell) = 10 ' change to suit or use variable
Range(TargetCell).Copy
Columns("M:M").PasteSpecial Paste:=xlPasteAll, Operation:=xlDivide, _
SkipBlanks:=False, Transpose:=False
Range(TargetCell).Clear

Regards,
Per

"blisspikle" skrev i meddelelsen
...
Is the anyway use similiar code as below, but create a Range in VBA
without using an actual range in excel... I would just like to use
the pastespecial function and divide my selection by a number without
having to write the number in a cell, then copy it, and then use
pastespecial, then have to delete the cell.

<Code
Selection.Copy
Columns("M:M").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlDivide,
SkipBlanks _
:=False, Transpose:=False
</Code




All times are GMT +1. The time now is 10:03 AM.

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