PC Review


Reply
Thread Tools Rate Thread

Creating Range in VBA Code and using Pastespecial

 
 
blisspikle
Guest
Posts: n/a
 
      12th Dec 2008
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 With Quote
 
 
 
 
Per Jessen
Guest
Posts: n/a
 
      13th Dec 2008
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" <(E-Mail Removed)> skrev i meddelelsen
news:ea199b6a-8ca9-4883-bb92-(E-Mail Removed)...
> 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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Range PasteSpecial error Cantru Microsoft Excel Programming 4 29th Oct 2009 08:34 PM
"PasteSpecial method of Range class failed" when range Number of Rows > 2000 eskimo2 Microsoft Excel Programming 0 19th Oct 2007 06:09 PM
PasteSpecial method of Range class failed Frank Hayes Microsoft Excel Programming 6 3rd Oct 2007 01:34 PM
Range Name Duplication and PasteSpecial Macro =?Utf-8?B?TWlrZSBXcm9i?= Microsoft Excel Programming 3 10th Jan 2005 04:32 PM
VB PasteSpecial when range changes mjwillyone Microsoft Excel Programming 4 28th Dec 2003 03:31 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:30 AM.