Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 361
Default Range variables

I'm trying to copy and paste data from one sheet to another and thought it
would be useful to group a range rather than each cell and then paste. Am I
able to create variables for ranges? I don't seem to be able to make it
work. The code I've got is:

Dim Cases as Range

Cases = Range("B25,B27,B29,B30,B31").Value

Range("B5").Select
ActiveCell.Value = Cases

That's with a few things cut out but you get the picture. Anyway, the macro
is giving a 91 bug and stopping as the Cases = Range part.

Any ideas would be very helpful.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Range variables

No, you can't do anything like that. You could do

Range("B25,B27,B29:B31").copy Range("B5")

--
Regards,
Tom Ogilvy


"carl" wrote:

I'm trying to copy and paste data from one sheet to another and thought it
would be useful to group a range rather than each cell and then paste. Am I
able to create variables for ranges? I don't seem to be able to make it
work. The code I've got is:

Dim Cases as Range

Cases = Range("B25,B27,B29,B30,B31").Value

Range("B5").Select
ActiveCell.Value = Cases

That's with a few things cut out but you get the picture. Anyway, the macro
is giving a 91 bug and stopping as the Cases = Range part.

Any ideas would be very helpful.

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
Sum a range based on two variables billy Excel Worksheet Functions 2 May 15th 08 07:03 PM
VBA Range Variables... MarkHear1 Excel Programming 2 February 15th 07 11:53 AM
Set few range variables at once Greg Excel Programming 4 November 15th 06 01:01 AM
Range of variables Ed Excel Programming 2 August 5th 06 03:05 PM
Range Variables Daniel[_7_] Excel Programming 1 November 20th 03 05:45 AM


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

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"