Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
"PasteSpecial method of Range class failed" when range Number of Rows 2000 eskimo2 Excel Programming 0 October 19th 07 06:09 PM
Pastespecial code Rayo K Excel Programming 1 July 17th 06 12:56 PM
Code for meet cond, copy, pasteSpecial, ValuesOnly ufo_pilot Excel Programming 0 December 7th 05 01:48 PM
Range Name Duplication and PasteSpecial Macro Mike Wrob Excel Programming 3 January 10th 05 04:32 PM
VB PasteSpecial when range changes mjwillyone[_2_] Excel Programming 4 December 28th 03 03:31 AM


All times are GMT +1. The time now is 11:33 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"