View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Per Jessen Per Jessen is offline
external usenet poster
 
Posts: 1,533
Default 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